Instance Method

resetPhysicsTransform(recursive:)

Resets the position, orientation, and velocities of the simulated physics body.

Declaration

func resetPhysicsTransform(recursive: Bool = true)

Parameters

recursive

Apply the reset to all descendant entities.

Discussion

Call this method only for dynamic rigid bodies, with a mode of PhysicsBodyMode.dynamic. This is the only kind of body that’s affected by physics simulations. For all others, modify the entity’s transform property directly.

Conversely, directly modifying the transform of a dynamic body has no effect because the physics simulation overwrites it on every frame.

See Also

Simulating Forces and Impulses

var physicsBody: PhysicsBodyComponent?

A component that is used for physics simulations of the model entity in accordance with the laws of Newtonian mechanics.

struct PhysicsBodyComponent

A component that defines an entity’s behavior in physics body simulations.

func addForce(SIMD3<Float>, relativeTo: Entity?)

Applies a force to the physics body at its center of mass.

func addForce(SIMD3<Float>, at: SIMD3<Float>, relativeTo: Entity?)

Applies a force to the physics body at the specified position.

func addTorque(SIMD3<Float>, relativeTo: Entity?)

Applies a torque to the physics body at its center of mass.

func clearForcesAndTorques()

Clears all forces previously added to the physics body.

func applyLinearImpulse(SIMD3<Float>, relativeTo: Entity?)

Applies an impulse to the physics body at its center of mass.

func applyAngularImpulse(SIMD3<Float>, relativeTo: Entity?)

Applies an angular (torque) impulse to the physics body at its center of mass.

func applyImpulse(SIMD3<Float>, at: SIMD3<Float>, relativeTo: Entity?)

Applies an impulse to the physics body at the specified position.

func resetPhysicsTransform(Transform, recursive: Bool)

Resets the position and velocities of the simulated physics body.

Deprecated
protocol HasPhysicsBody

An interface that enables physics simulations based on the rules of Newtonian mechanics.