Resets the position, orientation, and velocities of the simulated
physics body.
Call this method only for dynamic rigid bodies, with a
``PhysicsBodyComponent/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.
- Parameters:
- recursive: Apply the reset to all descendant entities.
Resets the position and velocities of the simulated physics body.
Call this method to change the transform applied to a body by physics
simulation. This only matters for dynamic rigid bodies, with a
``PhysicsBodyComponent/mode`` of ``PhysicsBodyMode/dynamic``. This is
the only kind of body that’s affected by physics simulations. For all
others, modify the entity’s ``HasTransform/transform`` property
directly.
Conversely, directly modifying the transform of a dynamic body has no
effect because the physics simulation overwrites it on every frame.
- Parameters:
- transform: The new transform to inject into the dynamic physics
simulation of the entity.
- recursive: Apply the reset to child entities.
get · iOS 13.0+
physicsBody
Swift declaration
@MainActor @preconcurrency var physicsBody: PhysicsBodyComponent? { get set }
A component that is used for physics simulations of the model entity in
accordance with the laws of Newtonian mechanics.
set · iOS 13.0+
physicsBody
Swift declaration
@MainActor @preconcurrency var physicsBody: PhysicsBodyComponent? { get set }
A component that is used for physics simulations of the model entity in
accordance with the laws of Newtonian mechanics.
Applies an impulse to the physics body at the specified position.
- Parameters:
- impulse: An impulse in newton seconds.
- position: The position at which to apply the impulse.
- referenceEntity: The reference entity that defines the coordinate
space in which `position` and `impulse` are defined.
Applies an impulse to the physics body at its center of mass.
- Parameters:
- impulse: An impulse in newton seconds.
- referenceEntity: The reference entity that defines the coordinate
space in which `impulse` is defined.
Applies an angular (torque) impulse to the physics body at its center of
mass.
- Parameters:
- impulse: An angular impulse in kilogram square meters per second.
- referenceEntity: The reference entity that defines the coordinate
space in which `impulse` is defined.
Applies a force to the physics body at its center of mass.
The physics simulator applies the added force until the end of the frame
interval. To continue exerting the force after that time, add the force
again with another call to the method. Handle the ``SceneEvents/Update``
event to receive an indication of when the frame interval ends. For an
app that renders at 60 frames per second (fps), this event occurs about
once per 16 milliseconds.
- Parameters:
- force: A force in newtons.
- referenceEntity: The reference entity that defines the coordinate
space in which `force` is defined.
Applies a force to the physics body at the specified position.
The physics simulator applies the added force until the end of the frame
interval. To continue exerting the force after that time, add the force
again with another call to the method. Handle the ``SceneEvents/Update``
event to receive an indication of when the frame interval ends. For an
app that renders at 60 frames per second (fps), this event occurs about
once per 16 milliseconds.
- Parameters:
- force: A force in newtons.
- position: The position at which to apply the force.
- referenceEntity: The reference entity that defines the coordinate
space in which `position` and `force` are defined.
Applies a torque to the physics body at its center of mass.
The physics simulator applies the added torque until the end of the
frame interval. To continue exerting the torque after that time, add the
torque again with another call to the method. Handle the
``SceneEvents/Update`` event to receive an indication of when the frame
interval ends. For an app that renders at 60 frames per second (fps),
this event occurs about once per 16 milliseconds.
- Parameters:
- torque: A torque in newton meters per radian.
- referenceEntity: The reference entity that defines the coordinate
space in which `torque` is defined.