using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/Simulation }
using { /Verse.org/SceneGraph }
using { /Verse.org/SpatialMath }
# Bolt this onto a platform entity to make it rise smoothly at startup.
rising_platform_component := class<final_super>(component):
# How far up to rise, in units. A knob in the editor.
@editable
var RiseHeight<public>:float = 100.0
OnSimulate<override>()<suspends>:void =
# Where are we right now, relative to our parent?
Start := Entity.GetLocalTransform()
# Build a target: same as now, but RiseHeight higher.
Target := transform:
Translation := vector3:
Left := Start.Translation.Left
Up := Start.Translation.Up + RiseHeight
Forward := Start.Translation.Forward
Rotation := Start.Rotation
Scale := Start.Scale
# Move there, then wait a moment.
Entity.SetLocalTransform(Target)
Sleep(1.0)
Verse Library
verse
05 Standalone
Moves an entity upward by a set distance over one second at startup.
verse-library/verse-scene-graph-hierarchy-transforms/05-standalone.verse