Trail
A Trail is a node that creates a trail behind the Entity.
Function | Description |
---|---|
globalDepth() |
Returns the depth of the Trail in a 2D World. |
setColor(r, g, b, a) |
Sets the color of the trail. |
setGlobalDepth(value) |
Sets the depth of the Trail in a 2D World. |
setUpVector(value) |
Sets the “up vector” of the Trail. This changes the orientation of the tail, which is useful for 2D games. |
upVector() |
Returns the “up vector” of the Trail. |
globalDepth()
Returns the global depth of the Trail node. Depth decides which object is on top in a 2D World. A higher value will be above a lower number in the Scene.
Returns
number – The global depth of the Trail
setColor(r, g, b, a)
Sets the color of the trail.
Parameters
number red – the red component of the new color
number green – the green component of the new color
number blue – the blue component of the new color
number alpha – (Optional) the opacity component of the new color, max 255
let trail = this.entity().component("Trail"); trail.setColor(193, 66, 66); // set the trail to be red
setGlobalDepth(value)
Sets the global depth of the Animation node. Depth decides which object is on top in a 2D World. A higher value will be above a lower number in the Scene.
Parameters
number value – The global depth of the Animation
setUpVector(value)
Sets the “up vector” of the Trail. This changes the orientation of the tail, which is useful for 2D games. The range is 0-1 for the x, y, and z values.
Parameters
Vec3 value – The new “up vector”
upVector()
Returns the “up vector” of the Trail.
Returns
Vec3 – The Trail’s “up vector”