Helpful Objects

From Frozenbyte
Jump to: navigation, search

These objects/entities are helpful to add when creating a level in the Editor.

AI path helpers

Watch a video about AI and AI path helpers

In Trine Enchanted Edition editor AI path helpers can be found from HelperEntity-->AIHelperEntity-->AIPathHelperEntity.

There are 6 basic types of AI path helpers:

  • Climb
  • Jump
  • Ledge
  • Ledge down
  • Move
  • Stop

Move and Stop helpers have separate objects for left and right, the other 4 can be flipped around z-axis (Ctrl+F in Trine EE editor). Jump helper has several different kind of objects for different situations and Ledge helper has three objects with different heights. Climb and Ledge down helpers have only one object each.

From the properties of the path helpers it is possible to change the position and size of the box area that triggers the helper animation. This can be done in BoxAreaComponent under Dimensions and Offset.

In the properties it is also possible to change the behaviour of the AI depending on the position of the target (the player character). In TrineAIPathHelperComponent there are two attributes called EnabledHeightLimitHigh and EnabledHeightLimitLow.

The tooltip says: "EnabledHeightLimitHigh/Low: If set, ai path helper is enabled only if AI's target is above/below the helper position. 0.0 = not in use."

With these two attributes it's possible to make the AI decide to go up a ledge if the target is above the AI, and down a ledge, if the target is below.

Camera areas

When entering the linked Box Area, the player triggers a new set of camera settings that will last until they enter another Camera Area.

CameraAreaEntity can be found under Entity -> AreaEntity -> CollectorArea -> BoxCollectorArea -> PlayerBoxCollectorArea -> AbstractInterpolatingPlayerBoxCollectorArea -> NonInterpolatingPlayerBoxCollectorArea

Change the Dimensions property of the area in the panel "Properties", under BoxAreaComponent, to define as of where the camera settings should be used.

The camera settings can be set in the Trine2CameraPropertiesComponent's properties:

  • PositionOffset - Original position of the camera relative to the origin of the entity. Use this for instance if you want your character to be in the corner of the screen
  • TargetOffset - Target refers to the what the camera aims at (the player). Use this for instance to make it look at something
  • PositionFollowFactor - Rate at which the camera moves to follow the player
  • TargetFollowFactor - Rate at which the camera turns to follow the player
  • CameraSpringConstant - Reaction speed. Rate at which the settings will ease into the new ones. The higher the faster.

Note : setting both PositionFollowFactor and TargetFollowFactor to (0,0,0) will get you a fixed camera, player independant.

Pro Tip: make a default CameraAreaEntity with global settings and paste it before and after specific CameraAreaEntitys to keep your general settings outside ponctual changes. Pro-er Tip: Change the colors of the ModelComponents of your CameraAreaEntitys according to what they do, so you know which is which. For instance, green for default, pink for fixed and blue for other.

Pro-er Tip: To quickly set up your cameras, select your CameraAreaEntity, then position the view of the editor as you'd like the camera in game to be positioned (with the CameraAreaEntity object as the target) and then in the top-right menu toolbar press View->Area, this will change the settings and give you a start setting to tweak into what you want. The reverse button next to it, Area->View gives you a peek at the cameras settings by changing your editor view.

Checkpoint

[Swamp/Witch]Checkpoint object are the level's respawn points, including the initial starting spot which can be enabled by enabling the 'MissionStartCheckpoint' option under TrineCheckpointComponent.

See Player (Re)spawn

Collisions

The models are art, so you need to add collisions via helpers such as collision_rock, collision_sand etc. In Trine Enchanted Edition editor the collision helpers are in ObjectEntity-->object-->helper-->collision_helper. Note that there are two nodes called collision_helper.

Collision helpers are objects that are invisible by default but can be turned visible from the properties under ModelComponent by setting VisibleInGame to true (in fact, this can be done with all the invisible models in the editor).

It is a good idea to put collision helpers in the "Coll." ( = Collision) layer.

Note: Make sure to use the right collision helper in the right situation. collision_wood allows grappling hook and arrows to stick, where as collision_shallow_water2 has built-in animation and sound effects for splashing water.

HingeJoints

Watch a video about hingejoints

HingeJoints allow objects to be "nailed to the wall", i.e. they hold the objects in place. They also allow rotation around the desired axis (x, y or z).

HingeJoints can be found from JointEntity-->HingeJoint. There you can choose between XHingeJoint, YHingeJoint or ZHingeJoint, where the first letters refer to the aforementioned axes.

When you have decided which axis you want to rotate about and thus chosen the correct X/Y/ZHingeJoint, you need to choose component/s which the HingeJoint refers to. This can be done by going to the properties of the HingeJoint and there going to Component0 under HingeJointComponent. By pressing "...", you can choose, either from you main editor window or the ChooseObjectDialog that opens, the desired object your HingeJoint uses as the first component. Every HingeJoint needs atleast one component (atleast Component0), otherwise the editor gives you an error and the HingeJoint is useless.

Placing the HingeJoint exactly in the middle of the object you want to rotate can be quite hard if you try to do it manually. There's an easier way: put the texture where you want it to be and go to the properties. Find Position under TransformComponent. If you're using YHingeJoint (as most often is the case), right click on the x, and select "Copy text to clipboard". Then go to the properties of the HingeJoint, find the Position under TransformComponent, right click the x and select "Paste text from clipboard". Repeat the process for the z values and your YHingeJoint should be exactly in the middle of the object. The positional value of the axis about which you're rotating can in theory be arbitrary, because you're rotating about that axis. So if you're using YHingeJoints, the y position values of the HingeJoint and the object don't need to be the same for the object to rotate.

If you want to give the impression of having two separate objects attached to each other (like the ropes tied to the two ends of a wooden plank in a traditional children's swing), you can use the Component1 to refer to a second object. This means that the the separate objects rotate around that same point in space, and it seems like they are "attached" together, instead of being just two separate objects, as they in reality are. In the swing example above, you would have a HingeJoint on the both ends of the wooden plank, the plank being the Component0 of the HingeJoints and the ropes being the Component1s of the HingeJoints.

Once you have determined what your components for the HingeJoints are, you need to decide how much and in which directions you want your objects to be able to rotate. In the properties of the HingeJoints, again under HingeJointComponent you can find RotationLimitHighAngle and RotationLimitLowAngle. These two values determine how much the HingeJoint allows the object/s to rotate. As long as the sum of the norms of the two values is 360 (or over it), they can rotate the full circle to both directions. In other words it doesn't matter if your RotationLimitHighAngle is 359 and your RotationLimitLowAngle is -1 or if your RotationLimitHighAngle is 0 and your RotationLimitLowAngle is -360, as long as the sum of the norms equals 360 or more.

Since the coordinate systems in the editor are left handed, with global x-axis (red arrow) pointing to right, global y-axis (the green arrow) pointing towards the user (out of the screen) and global z-axis (the blue arrow) pointing up, the positive angle means clockwise (cw) direction and the negative angle means counterclockwise (ccw) direction. So if you want your object to rotate only 90 degrees clockwise and back, you should put the RotationLimitHighAngle to 90 and the RotationLimitLowAngle to 0.

TODO: Write about RotationDriveVelocity/-Force/-Damping.

MissionExitEntity

Moving into this zone fades to black and ends the level.

Player re-spawn areas

See Player (Re)spawn

Rope helpers

Used for Thief's ninja rope skill. Gamepad controls requires these. Rope helpers helps autoaim logic.

TODO: Write more details

Spawners

Spawners can spawn any object or AIs. AIs has specific more complext spawners. There are single spawners and multi spawners.

TempInstantKillEntity

This kills the player when crossed, how Trine does fall to death.

WaterPoolEntity

TODO: Write info about these