pub const FORCE: &str = "type Force { value: Vec3 = Vec3 {}; }";Expand description
A world-space force applied every fixed physics tick.
The physics adapter applies it only to a dynamic RigidBody and reapplies the current value on each fixed step. Attaching Force without such a body is rejected.
§Declaration
type Force { value: Vec3 = Vec3 {}; }§Fields and methods
value: Force vector in newtons; defaults to zero and requires a dynamic RigidBody.
§Apply force on fixed ticks
The second callback observes movement produced by the first fixed integration step; the force remains attached for later steps.
let entity = spawn(Transform {});
add(entity, Sphere {});
add(entity, RigidBody {});
add(entity, Force { value: Vec3 { x: 4 } });
system Observe of Transform {
func frame(dt: Number) -> Unit {
if tick > 1 { print(self.position.x > 0); }
}
}