PhysicsBodyComponent
A component that defines an entity’s behavior in physics body simulations.
Declaration
struct PhysicsBodyComponentOverview
Only entities with a PhysicsBodyComponent and a CollisionComponent can participate in a scene’s physics simulation. If you need to move an entity that participates in the physics system, it also needs a PhysicsMotionComponent.
Add a physics body component to an entity by adopting the HasPhysicsBody protocol, which allows RealityKit’s physics simulation to compute behavior in response to forces acting upon the body, following basic rules of Newtonian mechanics.
Note the following when considering applying a non-uniform scale to an entity:
Non-uniform scaling is applicable only to box, convex mesh and triangle mesh collision shapes.
Non-uniform scaling is not supported for all other types of collision shapes. In this case the scale.x value is duplicated to the scale’s y and z components as well to force scale uniformity based on the x component.
If the entity has a non-uniform scale assigned to its transform then that entity should not have any descendants assigned that contain rotations in their transforms. A good rule of thumb is to assign the non-uniform scale to the entity that has the collision shape, and avoid adding children below that entity.
Topics
Creating a physics body component
init()init(massProperties:material:mode:)init(shapes:density:material:mode:)init(shapes:mass:material:mode:)