Physics.ForceMode
EnumType of force to use when applying force or torque to a BodyComponent.
- Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.
Index
Enumeration Members
Example
// @input Physics.BodyComponent bodyComponent
// Add instant impulse force upward
script.bodyComponent.addForce(new vec3(0, 500, 0), Physics.ForceMode.Impulse);
// Add instant impulse torque to rotate the object
script.bodyComponent.addTorque(new vec3(0, 0, Math.PI * -25), Physics.ForceMode.Impulse);
// Every frame, add upward force over time, relative to the object rotation
// This is similar to a rocket boosting the object upward
script.createEvent("UpdateEvent").bind(function() {
script.bodyComponent.addRelativeForce(new vec3(0, 2000, 0), Physics.ForceMode.Force);
});
Enumeration Members
Acceleration
Acceleration:
number
Continuous acceleration (cm/s^2), applied without respect to mass, used for cases where force is applied over multiple frames.
Force
Force:
number
Continuous force (kg*cm/s^2), used for cases where force is applied over multiple frames.
Impulse
Impulse:
number
Instantaneous force impulse (kg*cm/s).
VelocityChange
VelocityChange:
number
Instantaneous change in velocity (cm/s), applied without respect to mass.