Structure

PhysicsMotionComponent

A component that controls the motion of the body in physics simulations.

Declaration

struct PhysicsMotionComponent

Overview

You specify velocities in the coordinate space of the physics simulation defined by physicsOrigin.

The behavior of an entity with a physics motion component depends on the entity’s mode setting:

PhysicsBodyMode.static

The physics simulation ignores the velocities. The entity doesn’t move.

PhysicsBodyMode.kinematic

The physics simulation moves the body according to the values you set for angularVelocity and linearVelocity.

PhysicsBodyMode.dynamic

The physics simulation overwrites the velocity values based on simulation, and ignores any values that you write.

Topics

Creating the Motion Component

init()

Creates a physics motion component at rest.

init(linearVelocity: SIMD3<Float>, angularVelocity: SIMD3<Float>)

Creates a physics motion component with the given velocities.

Setting Velocity

var angularVelocity: SIMD3<Float>

The angular velocity of the body around the center of mass.

var linearVelocity: SIMD3<Float>

The linear velocity of the body in the physics simulation.

Registering a Component Type

static func registerComponent()

Registers a new component type.

Comparing Physics Motion Components

static func == (PhysicsMotionComponent, PhysicsMotionComponent) -> Bool

Indicates whether two physics motion components are equal.

static func != (PhysicsMotionComponent, PhysicsMotionComponent) -> Bool

Indicates whether two physics motion components are not equal.

Relationships

Conforms To

See Also

Simulating Movement

var physicsMotion: PhysicsMotionComponent?

The physics motion component used by physics simulations of the model entity.

protocol HasPhysicsMotion

An interface that provides velocity properties for physics simulations.

protocol HasPhysics

An interface that combines the physics body and physics motion interfaces.