The force effect input data to the effect's update handler or closure.
Members (13)
method · iOS 18.0+
setForce
TypeScript
setForce(force: SDKHandle, index: number): void
Swift declaration
func setForce(_ force: SIMD3<Float>, index: Int)
Sets the force for each rigid body.
Inside the force effect update function, you are responsible to compute and output the force
by calling this function for each rigid body. If you omit this function for a rigid body, that rigid body
gets zero force from the effect.
- Parameters:
- force: The force value.
- index: The index to the rigid body. The index should be in the range [0, ``ForceEffectParameters/physicsBodyCount``].
get · iOS 18.0+
velocities
TypeScript
get velocities(): (UnsafeForceEffectBuffer<SDKHandle>) | null
Swift declaration
let velocities: UnsafeForceEffectBuffer<SIMD3<Float>>?
The velocities of all rigid bodies under the influence of the effect,
or nil if velocity information was not requested.
get · iOS 18.0+
elapsedTime
TypeScript
get elapsedTime(): number
Swift declaration
let elapsedTime: TimeInterval
The amount of time that has elapsed since the force effect was started.
get · iOS 18.0+
orientations
TypeScript
get orientations(): (UnsafeForceEffectBuffer<SDKHandle>) | null
Swift declaration
let orientations: UnsafeForceEffectBuffer<simd_quatf>?
The orientations of all rigid bodies under the influence of the effect,
or nil if rotational information was not requested.
The orientation is relative to the effect's transform.
get · iOS 18.0+
fixedDeltaTime
TypeScript
get fixedDeltaTime(): number
Swift declaration
let fixedDeltaTime: TimeInterval
The fixed delta time between simulation steps.
get · iOS 18.0+
inertiaTensors
TypeScript
get inertiaTensors(): (UnsafeForceEffectBuffer<SDKHandle>) | null
Swift declaration
let inertiaTensors: UnsafeForceEffectBuffer<simd_float3x3>?
The inertia tensor based on the current rigid body's orientation, or nil if
inertia tensor information was not requested.
get · iOS 18.0+
physicsBodyCount
TypeScript
get physicsBodyCount(): number
Swift declaration
let physicsBodyCount: Int
The number of physics bodies to be updated.
get · iOS 18.0+
angularVelocities
TypeScript
get angularVelocities(): (UnsafeForceEffectBuffer<SDKHandle>) | null
Swift declaration
let angularVelocities: UnsafeForceEffectBuffer<SIMD3<Float>>?
The angular velocities of all rigid bodies under the influence of the effect,
or nil if angular velocity information was not requested.
get · iOS 18.0+
entity
TypeScript
get entity(): Entity
Swift declaration
let entity: Entity
The entity containing the force effect.
get · iOS 18.0+
masses
TypeScript
get masses(): (UnsafeForceEffectBuffer<number>) | null
Swift declaration
let masses: UnsafeForceEffectBuffer<Float>?
The mass of each rigid body, or nil if mass information was not requested
or force mode does not require it.
get · iOS 18.0+
distances
TypeScript
get distances(): (UnsafeForceEffectBuffer<number>) | null
Swift declaration
let distances: UnsafeForceEffectBuffer<Float>?
The distance from the effect to each rigid body's center of mass,
or nil if distance information was not requested.
get · iOS 18.0+
positions
TypeScript
get positions(): (UnsafeForceEffectBuffer<SDKHandle>) | null
Swift declaration
let positions: UnsafeForceEffectBuffer<SIMD3<Float>>?
The positions of all rigid bodies under the influence of the effect,
or nil if positional information was not requested.
The position is located at each body's center of mass, relative to the origin of the effect.
Sets the torque for each rigid body.
Inside the force effect update function, you are responsible to compute and output the torque
by calling this function for each rigid body. If you omit this function for a rigid body, that rigid body
gets zero torque from the effect.
- Parameters:
- torque: The torque value.
- index: The index to the rigid body. The index should be in the range [0, ``ForceEffectParameters/physicsBodyCount``].