DEdit Objects: WorldModels - WildChargerTV/TRON-2.0-Security-Protocol GitHub Wiki
WorldModels: Overview
In a shocking turn of events, Monolith actually has very well put-together documentation in regard to WorldModels, with the only exceptions being Breakable and WorldModelDebris. So for the most part, I'll let them take this away. Edits have been made, of course, to clean up unused content, remove references to NOLF, and improve presentability.
General
The naming convention should be mentioned first. Conceptually, there are three basic Objects to keep track of: WorldModels, Doors, and Switches. Each of these three Objects has two different Movement Types describing how they behave, with the only exception being the WorldModel parent Object, which has no preset Movement Type.
- "Rotating" means the Object(s) will rotate a specified number of degrees around a point on each axis.
- "Sliding" objects will move a specified number of units in a specified direction. Think of the behavior of a desk drawer.
Note: Breakables and WorldModelDebris appear to be a new addition to the LithTech engine at the time of TRON 2.0, and are awaiting further research as no mention of these were made.
Each Movement Type has identical Attributes, and behaves exactly the same across the Objects in their type. So when you are learning how to use a RotatingWorldModel, you are also learning the RotatingSwitch and RotatingDoor. However, even though a RotatingWorldModel can be used exactly as a RotatingDoor, you should NOT put a RotatingWorldModel where a Door should go, nor vice versa. Use a Door only for Doors, use Switches only for Switches, and use WorldModels for everything else. Players, as well as NPCs, will both need to know if they are interacting with a Door, a Switch, or something else.
Most basic functionality is shared for every new WorldModel Object, in that they have common features and Attributes that you can edit. They are all created the same way, they all move and rotate based on their local coordinate system, and they can all receive certain Messages. โActiveโ WorldModels - that is, any Rotating or Sliding Objects - can also send Commands to other objects, and play Sounds depending on what state they are in.
Creation
To create an instance of a WorldModel, just bind a WorldModel Object to a Brush (or a set of Brushes). There are several Attributes you can edit to achieve the Object you want. For example, BlendModes is a value drop-down list containing several blend operations for your WorldModel. WorldModels can have Additive blending, they can be Chromakeyed, or they can be Translucent. 'None' is the default BlendMode for newly created WorldModels. You can also edit several other Attributes, such as visibility and solidity.
If you have a fairly complex Brush that the Player will be walking on or moving around, you may want to set the BoxPhysics Attribute to FALSE
. You can override the surface flags set by the Texture mapped to the Brush(s) by simply selecting the desired surface in the SurfaceOverride Attribute dropdown list.
Once a WorldModel is positioned and behaves as you would like, you can rotate it by selecting both the Object and all Brushes it is bound to, then select "Rotate Object" in DEdit's context menu. You can rotate the WorldModel on all axes, and in any direction. The WorldModel will then move or rotate with the same behavior around its own local coordinate system.
Damage
All WorldModels can handle damage. Each one has an Attribute subset labeled DamageProperties. There are several different values and flags that can all be edited to define how the WorldModel behaves when damaged. Here is a list of the Attributes that are included in the DamageProperties subset and what each one means:
- HitPoints: Number of hit points the WorldModel has when created.
- MaxHitPoints: Max number of hit points the WorldModel can ever have.
- Armor: Amount of armor that the WorldModel has when it is created.
- MaxArmor: Max amount of armor the WorldModel can ever have.
- DamageTriggerCounter: How many times the object must be damaged before the damage message will be sent.
- DamageTriggerTarget: Name of the object that will receive the DamageTriggerMessage.
- DamageTriggerMessage: Command string that is sent when the WorldModel receives damage from any source.
- DamageTriggerNumSends: Specifies how many times the damage message will be sent.
- DamageMessage: Command string that is sent to the object that caused the damage.
- DeathTriggerTarget: Name of the object that will receive the DeathTriggerMessage.
- DeathTriggerMessage: Command string that is sent when the WorldModel has been destroyed.
- PlayerDeathTriggerTarget: Name of the object that receives the PlayerDeathTriggerMessage.
- PlayerDeathTriggerMessage: Command string that is sent when the player destroys the WorldModel.
- KillerMessage: Command string is sent to the object that destroys this WorldModel.
- CanHeal: Toggles whether the WorldModel can be healed.
- CanRepair: Toggles whether the WorldModel can be repaired.
- CanDamage: Toggles whether the WorldModel can be damaged.
- Mass: Sets the mass of the WorldModel within the game.
- NeverDestroy: Toggles whether the WorldModel can be destroyed.
Attachments
All WorldModels can have Attachments. You can attach Models, Props, and other WorldModels. When attached to a WorldModel, Objects will move and rotate with the WorldModel. To have an Object attach to a WorldModel when the game loads, add the Object you want to attach and position it in DEdit, then enter the name of the Object you want to attach in the Attachments value field. You can have as many Objects attached to a WorldModel as you want (just keep performance in mind!). List all the Objects you want attached, separated by a semicolon (ex. Prop1; Prop2; SlidingWorldModel0
). During runtime of the game, you can attach and detach Objects through Messages.
States
All Rotating & Sliding WorldModels have four different states they can go through:
- 'PowerOn'
- 'On'
- 'PowerOff'
- 'Off'
Doors have similar states with different names:
- 'Opening'
- 'Open'
- 'Closing'
- 'Closed'
By default, all Objects start in the 'Off'/'Closed' state - this can be changed in the Options Attribute subset.
When positioning and rotating the Object in DEdit, you are setting its 'Off'/'Closed' position. By entering in values for the Movement or Rotation Attributes, you are setting how and where the Object will move to when fully 'On'/'Open'. Sliding WorldModels will be moving in the direction you specified while in the 'PowerOn'/'Opening' state, and when they have moved to the distance you specified, they are considered 'On'/'Open'. While moving back to their original position and rotation, they are in the 'PowerOff'/'Closing' state, and when they have reached their original position and are at rest, they are considered 'Off'/'Closed'. Both Rotating and Sliding Objects will stay still in their 'On'/'Open' positions and rotations.
Messages
All WorldModels can receive ATTACH
and DETACH
Messages sent from other Objects. To send an ATTACH
, just send a Message to a WorldModel like you would other Objects, and enter the name of the Object you want to ATTACH
(Ex. msg WorldModelName (ATTACH Prop0)
). Only one Object can be attached at a time using this method. When another ATTACH
Message is sent to the same WorldModel, the first attachment is detached, and the new Object is attached in its stead. To detach the Object you attached with an ATTACH
Message, send the Object a DETACH
Message. DETACH
takes no additional parameters (Ex. msg WorldModelName DETACH
).
All Rotating & Sliding WorldModels can also receive Messages to turn 'On'/'Open' and 'Off'/'Closed' respectively. Messages that these WorldModels can receive are:
ON
: If not already in the 'On'/'Open' or 'PowerOn'/'Opening' state, puts the WorldModel in the 'PowerOn'/'Opening' state.TRIGGERON
: Same asON
.OFF
: If not already in the 'Off'/'Closed' or 'PowerOff'/'Closing' state, puts the WorldModel in the 'PowerOff'/'Closing' state.TRIGGEROFF
: Same asOFF
.TRIGGER
: Toggles the WorldModel's state. Basically the same as when a Player interacts with the Object. If the WorldModel is in the 'On'/'Open' or 'PowerOn'/'Opening' state, it will immediately switch to 'PowerOff'/'Closing'. If it's in the 'Off'/'Closed' or 'PowerOff'/'Closing' state, then it will immediately switch to 'PowerOn'/'Opening'.LOCK
: Locks the Object. Once locked, the Object cannot be activated, regardless of whether it is in the 'On'/'Open' or 'Off'/'Closed' state.UNLOCK
: Unlocks the Object, so that it can now be activated by the Player and Messages.
These Messages take no other parameters. For example, to toggle a RotatingWorldModel's current state, you would use: msg RotatingWorldModelName TRIGGER
.
Options
All Rotating & Sliding WorldModels have several options that can be changed in the Options Attribute subset. These control how interactive the Objects are & set some other behaviors.
- Both PlayerActivate and AIActivate let the Object know who, if anybody, can interact with it.
- If these are both
FALSE
, then it can only be activated via Messages. - If PlayerActivate is
TRUE
, then a Player can trigger the Object using their default interaction method.
- If these are both
- StartOn, when
TRUE
, puts the Object in the 'PowerOn'/'Opening' state as soon as the game loads. - TriggerOff toggles whether or not the Object can be turned off/closed specifically.
- RemainOn, if
TRUE
, will keep the Object in its' 'On'/'Open' state until told to turn off/close, either by the Player or another Object. - Locked, when
TRUE
, will start the Object off as being locked. While locked, the Object cannot turn on/open or turn off/close until it is unlocked through a Message. - Waveform is a drop-down list of Movement Types that the Object will use to rotate or move.
Commands
All Rotating & Sliding WorldModels can send Commands based on what state they are in. There are 5 Commands listed in the Commands Attribute subset group: OnCommand, OffCommand, PowerOnCommand, PowerOffComand, and LockedComand. Doors have similar Commands with different names: OpenCommand, ClosedCommand, OpeningCommand, and ClosingCommand (LockedCommand is unchanged). Each Command line can have multiple Commands entered, separated by semicolons, and each one will be executed every time the WorldModel first enters the corresponding state. To have a Command executed as soon as a WorldModel is activated - either by a Player interaction, or by receiving an ON
Message - simply enter the Command in the PowerOnCommand or OpeningCommand line. If you would like a Command executed at the end of a WorldModel's movement or rotation, enter it in the OnCommand line. The LockedCommand will be executed if the WorldModel is locked, and a Player or Message tries to activate it.
Sounds
All Rotating & Sliding WorldModels can play Sounds based on what state they are in. There are 5 Sounds listed in the Sounds Attribute subset group: PowerOnSound, OnSound, PowerOffSound, OffSound, and LockedSound. Doors have similar Sounds with different names: OpeningSound, OpenSound, ClosingSound, and ClosedSound (LockedSound is unchanged). Other Attributes that can be edited in this subset group are: the relative Sound position, the radius the Sound fades off to, and weather or not the Sound(s) will loop (the LockedSound will never loop). Each Sound is a single .wav file that is easily picked through a browser. The Sound(s) will start playing every time the WorldModel first enters the corresponding state. To have a Sound start playing every time the WorldModel starts to turn off/close, enter it in the PowerOffSound or ClosingSound line. The LockedSound will play if the WorldModel is locked, and a Player or Message tries to activate it.
Animated Lightmaps*
All Rotating & Sliding WorldModels can have animated Lightmaps associated with their movement or rotation. To create animated Lightmaps, you must first add a KeyframerLight object. Set the properties of the KeyframerLight as desired, and then position it close to the WorldModel object you would like to lightmap (if itโs a directional light, then make sure the light is pointed in the right direction). Setting ShadowMap to FALSE typically looks much better. Once the KeyframerLight is set, just type the name of the KeyframerLight object in the ShadowLights property. You can enter up to 8 lights in the ShadowLights property separated by semicolons. Now just enter the number of frames you would like to have in the animation, up to 128. Sometimes less frames actually look better but experiment and use what works best. Remember that more animations and more frames in the animations is a real memory hog. Too many animated lightmaps is also a real frame rate killer!
WorldModel
Features
This is the basic "non-active" WorldModel Object. It does not slide or rotate, does not play any Sounds, and cannot execute any Commands. Like the others, this can handle Attachments, can have BlendModes, has Damage properties, and can have a surface type assigned to it.
Use
Any place where you need a stationary WorldModel, this is the Object you should use. Think of a gameplay element that you would want to damage, or to provide Attachments to. This Object is also very well suited for keyframing. If you want a keyframed WorldModel, you should use this Object.
Creation
This Object is created normally. Simply bind it to a Brush (or groups of Brushes), and then edit the Attributes as needed.
Damage
This Object can handle damage. Edit the DamageProperties subset to define behaviors.
Attachments
This Object can handle Attachments. Enter all of the Objects you want attached to the WorldModel, separated by semicolons, in the Attachments Attribute.
States
None โ this Object does not slide or rotate, so there is no need for states.
Messages
WorldModels can receive these Messages:
ATTACH
: Attaches the Object specified in the Message.DETACH
: Detaches the Object attached with theATTACH
Message.
Options
None โ neither the Player nor AI can activate this Object. It has no built-in movement or rotation capability.
Commands
None โ this Object cannot execute any Commands.
Sounds
None โ this Object cannot play any Sounds.
Breakable
RotatingDoor
RotatingSwitch
RotatingWorldModel
Features
This WorldModel can rotate a specified number of degrees around a point on each axis. The Player can interact with this Object, or it can be controlled by other Objects through Messages. Sounds can be played & Commands can be executed when certain states are reached. Like the others, this can handle Attachments, can have BlendModes, has Damage properties, and can have a surface type assigned to it. This WorldModel can also have an animated Lightmap associated with it.
Use
Any place you want a WorldModel that should swing, as if it were hinged to a wall. Think of kitchen cabinets or window shutters as a good example of what these can be used for, but of course, there are many uses.
Creation
This Object is created normally. Simply bind this Object to a Brush (or group of Brushes). To set its rotation values, just edit the vector labeled 'RotationAngles', and either position the bound Object where you would like it to rotate around, or link it to a Point Object positioned where you want the object to rotate around. Enter the number of degrees, positive or negative, around each axis you would like this Object to rotate.
Using a kitchen cabinet as an example, you would create your Brush in the closed position, bind a RotatingWorldModel to the Brush, move the bound Object to either the left or right edge of the Brush, and then edit the vector (0.0 140.0 0.0
). The cabinet door would then open out 140 degrees in the game.
Damage
This Object can handle damage. Edit the DamageProperties subset to define behaviors.
Attachments
This Object can handle attachments. Enter all of the Objects you want attached to the RotatingWorldModel, separated by semicolons, in the Attachments Attribute.
States
- On: When the RotatingWorldModel is fully rotated to the degree amounts specified in the RotationAngles Attribute, it is considered 'On'.
- PowerOn: While rotating towards the 'On' position, it is considered to be in the 'PowerOn' state.
- Off: By default, RotatingWorldModels start in the 'Off' position, and are considered 'Off' while in this position.
- PowerOff: While rotating from the โOnโ position towards the 'Off' position, the RotatingWorldModel is in the 'PowerOff' state.
Messages
A RotatingWorldModel can receive these Messages:
ATTACH
: Attaches the Object specified in the Message.DETACH
: Detaches the Object attached with theATTACH
message.ON
: If not already in the 'On' or 'PowerOn' states, puts the RotatingWorldModel in the 'PowerOn' state.OFF
: If not already in the 'Off' or 'PowerOff' states, puts the RotatingWorldModel in the 'PowerOff' state.TRIGGER
: Toggles the state. Basically the same as when a Player interacts with the Object. If the RotatingWorldModel is in the 'On' or 'PowerOn' state, it will immediately switch to 'PowerOff'. If it's in the 'Off' or 'PowerOff' state, then it will immediately switch to 'PowerOn'.LOCK
: Locks the Object. Once locked, the Object cannot be activated, regardless of whether it is in the 'On'/'Open' or 'Off'/'Closed' state.UNLOCK
: Unlocks the Object, so that it can now be activated by the Player and Messages.
Options
A RotatingWorldModel can have these options edited:
- PlayerActivate: Toggles if the Player can interact with the RotatingWorldModel or not.
- StartOn: When
TRUE
, the RotatingWorldModel is in the 'On' position at load time. - TriggerOff: Toggles whether or not the Player can directly turn a RotatingWorldModel 'Off'.
- RemainOn: If this is
TRUE
, the RotatingWorldModel will stay in the 'On' position until directly told to turn off, either by a Player or a Message. - ForceMove: When
TRUE
, the RotatingWorldModel will rotate through the Player and other Objects. - Locked: Toggles whether this Object starts locked or not.
- RotateAway: If
TRUE
, the RotatingWorldModel will swing away from the Player. - Waveform: Defines how the Object rotates.
Commands
A RotatingWorldModel can send these Commands when in the corresponding appropriate state:
- OnCommand
- OffCommand
- PowerOnCommand
- PowerOffCommand
- LockedCommand
Sounds
A RotatingWorldModel can play these sounds when in the corresponding state.
- PowerOnSound
- OnSound
- PowerOffSound
- OffSound
- LockedSound
Animated Lightmaps
This object supports animated Lightmaps.
SlidingDoor
SlidingSwitch
SlidingWorldModel
Features
This WorldModel can slide, or move, a specified number of units in a specified direction. The Player can interact with this Object, or it can be controlled by other Objects through Messages. Sounds can be played & Commands can be executed when certain states are reached. Like the others, this can handle Attachments, can have BlendModes, has Damage properties, and can have a surface type assigned to it. This WorldModel can also have an animated Lightmap associated with it.
Use
Any place you want a WorldModel that should move in a specific direction. Think of desk drawers as a good example of what these can be used for, but of course, there are many uses.
Creation
This Object is created normally. Simply bind this Object to a Brush (or group of Brushes). To set its movement values, just edit the vector labeled 'MoveDir', and set the total distance you would like this SlidingWorldModel to move to the Attribute labeled 'MoveDist'.
The 'MoveDir' Attribute can be edited to point in any direction you want. A vector of 0.0 1.0 0.0
will move the SlidingWorldModel along its own local Y axis (typically straight up), and a vector of 0.5 0.5 0.0
will move the SlidingWorldModel diagonally along its X and Y axis.
The 'MoveDist' Attribute is the distance the SlidingWorldModel will travel in DEdit units. Using the desk drawer as an example, you would create your Brush in the closed position, bind a SlidingWorldModel to the Brush, and then set the 'MoveDir' vector to 0.0 0.0 1.0
. Then you would specify how far you want the Object to move by setting 'MoveDist' to 64.0
. The desk drawer would then slide 64 units out in the Z direction ingame.
Damage
This Object can handle damage. Edit the DamageProperties subset to define behaviors.
Attachments
This Object can handle attachments. Enter all of the Objects you want attached to the SlidingWorldModel, separated by semicolons, in the Attachments Attribute.
States
- On: When the SlidingWorldModel is fully moved to the distance specified in the 'MoveDist' Attribute, it is considered 'On'.
- PowerOn: While moving towards the 'On' position, it is considered to be in the 'PowerOn' state.
- Off: By default, SlidingWorldModels start in the 'Off' position, and are considered 'Off' while in this position.
- PowerOff: While moving from the โOnโ position towards the 'Off' position, the SlidingWorldModel is in the 'PowerOff' state.
Messages
A SlidingWorldModel can receive these Messages:
ATTACH
: Attaches the Object specified in the Message.DETACH
: Detaches the Object attached with theATTACH
message.ON
: If not already in the 'On' or 'PowerOn' states, puts the SlidingWorldModel in the 'PowerOn' state.OFF
: If not already in the 'Off' or 'PowerOff' states, puts the SlidingWorldModel in the 'PowerOff' state.TRIGGER
: Toggles the state. Basically the same as when a Player interacts with the Object. If the SlidingWorldModel is in the 'On' or 'PowerOn' state, it will immediately switch to 'PowerOff'. If it's in the 'Off' or 'PowerOff' state, then it will immediately switch to 'PowerOn'.LOCK
: Locks the Object. Once locked, the Object cannot be activated, regardless of whether it is in the 'On'/'Open' or 'Off'/'Closed' state.UNLOCK
: Unlocks the Object, so that it can now be activated by the Player and Messages.
Options
A SlidingWorldModel can have these options edited:
- PlayerActivate: Toggles if the Player can interact with the SlidingWorldModel or not.
- StartOn: When
TRUE
, the SlidingWorldModel is in the 'On' position at load time. - TriggerOff: Toggles whether or not the Player can directly turn a SlidingWorldModel 'Off'.
- RemainOn: If this is
TRUE
, the SlidingWorldModel will stay in the 'On' position until directly told to turn off, either by a Player or a Message. - ForceMove: When
TRUE
, the SlidingWorldModel will rotate through the Player and other Objects. - Locked: Toggles whether this Object starts locked or not.
- RotateAway: If
TRUE
, the SlidingWorldModel will swing away from the Player. - Waveform: Defines how the Object rotates.
Commands
A SlidingWorldModel can send these Commands when in the corresponding appropriate state:
- OnCommand
- OffCommand
- PowerOnCommand
- PowerOffCommand
- LockedCommand
Sounds
A SlidingWorldModel can play these sounds when in the corresponding state.
- PowerOnSound
- OnSound
- PowerOffSound
- OffSound
- LockedSound
Animated Lightmaps
This object supports animated Lightmaps.