sys_physics_integrate
The first step of the physics simulation: integrate the rigid
body's acceleration and velocity, and update the
entity's transform.
For the physics simulation to work correctly, the following order of systems
is recommended.
FixedUpdate(delta: number) {
sys_physics_integrate(this, delta);
sys_transform(this, delta);
sys_collide(this, delta);
sys_physics_kinematic(this, delta);
sys_physics_resolve(this, delta);
sys_transform(this, delta);
}
For deterministic results, the physics simulation should be run inside
Game.FixedUpdate
. Be careful about processing input inside FixedUpdate
.
It's OK to handle continuous input, like "is the key down for the duration
of this update?". On the other hand, handling discrete input inside
FixedUpdate
, like "has the key been pressed during this update?" will lead
to skipped input or input applied multiple times.