Summary
When adding a component to Entity → Scene → Play, the component has very significant issues with movement. The problem is fixed by adding a delay between adding it to the scene and start the movement: in my case the minimum delay is 0.1 seconds.
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Stability
Steps to Reproduce
- Run the code below
- EPD_Test is an empty prefab with a standard mesh. There are no other components.
test_component<public> := class<final_super>(component):
@editable
Button<public> : button_device
OnSimulate<override>()<suspends>:void=
loop:
Button.InteractedWithEvent.Await()
spawn { CreateNewEntity() }
CreateNewEntity<private>()<suspends>:void=
Print("Create")
NewEntity := EPD_Test{}
KeyframedMovementComponent := keyframed_movement_component:
Entity := NewEntity
NewEntity.AddComponents(array{KeyframedMovementComponent})
if(SimulationEntity := Entity.GetSimulationEntity[]):
SimulationEntity.AddEntities(array{NewEntity})
NewEntity.SetGlobalTransform(Entity.GetGlobalTransform())
Print("Add Entity to sim")
Sleep(0.1) # SLEEP FIX
Keyframes := array:
keyframed_movement_delta:
Transform := transform:
Translation := vector3{Forward:= 1000.0}
Duration := 1.5
KeyframedMovementComponent.SetKeyframes(Keyframes, oneshot_keyframed_movement_playback_mode{})
KeyframedMovementComponent.Play()
Expected Result
The movement should be smooth
Observed Result
Jittering
Platform(s)
windows