Grimwar/Entities/func tracktrain
Move owned geometry along an authored path.
Placement: Geometry owned by the entity.
Set it up
Parent moving geometry beneath the entity. Edit Path Points in the inspector or viewport; they are local metre coordinates relative to the authored pivot. Use at least two distinct consecutive points. The compiler creates the external spline, so you do not need to create a Unity SplineContainer in Vertex. Choose Stop, Loop, or Ping Pong for end behavior. set_progress takes 0..1 and fails while locked. Signed set_speed selects direction. Locking blocks control inputs but does not stop motion already in progress.
Settings
These are the initial authoring values. Script inputs and runtime state are listed separately below.
| Setting | Default | Meaning and choices |
|---|---|---|
path_smoothSmooth curves |
false |
Smooth the path through its points. Turn off for straight segments and sharp corners. |
path_closedClosed path |
false |
Join the last point to the first. Movement and end behaviour are configured separately. |
spline_containerPath points |
[[0, 0, 0], [0, 0, -4]] |
Ordered points relative to the authored pivot. The generated path stays outside the moving entity. Drag points in a viewport or enter their coordinates below. Ordered list. At least 2 entries. Units: metres. |
start_progress01Start Progress 01 |
0 |
Initial position along the spline, using its normalized 0-1 parameter. Minimum: 0. Maximum: 1.
|
follow_spline_rotationFollow Spline Rotation |
true |
Rotate the train to follow the spline tangent and up direction. |
rotation_offsetRotation Offset |
[0, 0, 0] |
Euler offset applied after the spline rotation. Use this when the authored model faces a different local axis. |
speedSpeed |
4 |
World units per second along the spline. Runtime set_speed accepts a signed value. Minimum: 0.01.
|
end_behaviorEnd Behavior |
Stop (0) |
What happens when the train reaches either end of the spline. Choices: Stop (0), Loop (1), Ping Pong (2).
|
damageDamage |
0 |
Damage dealt when the moving train drives into a damageable target. Separating and tangential contacts do not deal damage. 0 disables it. Minimum: 0.
|
damage_cooldown_secondsDamage Cooldown Seconds |
0.25 |
Minimum seconds between collision-damage events against the same target. Minimum: 0.01.
|
start_activeStart Active |
true |
Start moving as soon as the entity initializes. |
reverse_directionReverse Direction |
false |
Start by moving toward spline progress 0 instead of 1. |
start_lockedStart Locked |
false |
Ignore movement-control inputs until unlocked. Existing motion is not paused by locking. |
ignore_nav_meshIgnore Nav Mesh |
true |
Exclude this entity from navigation-mesh building. This does not disable its gameplay collision. |
VSig contract
Use the names below with a ref bound to this entity. The value column describes the catalog value type, not a C# method signature. See Read the reference for arguments, authority, and common controls.
| Kind | Member | Value | Authority / access |
|---|---|---|---|
| Input | kill |
none |
Server |
| Input | lock |
string |
Server |
| Input | reset |
string |
Server |
| Input | reverse |
string |
Server |
| Input | set_progress |
float |
Server |
| Input | set_speed |
float |
Server |
| Input | start |
string |
Server |
| Input | stop |
string |
Server |
| Input | toggle |
string |
Server |
| Input | unlock |
string |
Server |
| Output | killed |
none |
Server |
| Output | loop |
string |
Server |
| Output | progress |
float |
Server |
| Output | reached_end |
string |
Server |
| Output | reached_start |
string |
Server |
| Output | reversed |
string |
Server |
| Output | started |
string |
Server |
| Output | stopped |
string |
Server |
| Property | is_active |
bool |
Server; read/write |
| Property | is_locked |
bool |
Server; read/write |
| Property | is_reversed |
bool |
Server; read/write |
| Property | progress |
float |
Server; read/write |
| Property | speed |
float |
Server; read/write |
| State | state |
TrackTrainEntityState |
Server; read/write |
Capture ref.state from one matching entity and use ref.restore(saved_state) to restore a compatible snapshot.