pub const IMPULSE: &str = "type Impulse { value: Vec3 = Vec3 {}; }";Expand description
A world-space impulse consumed once by physics reconciliation.
The physics adapter accepts it only with a dynamic RigidBody, applies it once,
then resets value to zero. Attaching Impulse without such a body is rejected.
§Declaration
type Impulse { value: Vec3 = Vec3 {}; }§Fields and methods
value: Impulse vector in newton-seconds; defaults to zero and requires a dynamic RigidBody.
§Apply one impulse
The second callback observes movement from the first integration step, after which the adapter has consumed the impulse.
let entity = spawn(Transform {});
add(entity, Sphere {});
add(entity, RigidBody {});
add(entity, Impulse { value: Vec3 { x: 3 } });
system Observe of Transform {
func frame(dt: Number) -> Unit {
if tick > 1 { print(self.position.x > 0); }
}
}