One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

ImpulseAction

struct · iOS 18.0+ · SDK 27.1

struct ImpulseAction

An action that applies an impulse to the physics body at its center of mass when played as an animation. This action requires a ``CollisionComponent`` and ``PhysicsBodyComponent`` with the ``PhysicsBodyComponent/mode`` set to ``PhysicsBodyMode/dynamic``. Without these settings, the impulse has no effect on the entity. The example below creates an animation which applies an impulse to the entity after five seconds. ```swift // Create an action to apply an impulse, forcing the object to move upwards. let impulseAction = ImpulseAction(linearImpulse: [0, 1, 0]) // Create a small positive duration value. let duration: TimeInterval = 1 / 30.0 // Create an animation for the action, which will start playing // after five seconds. let impulseAnimation = try AnimationResource .makeActionAnimation(for: impulseAction, duration: duration, delay: 5.0) // Play the sequence animation that will play the actions. entity.playAnimation(impulseAnimation) ``` - Important: This action does not directly animate a bound property, such as ``BindTarget/transform``. - Tip: This action performs instantaneously, consider supplying a small positive duration value when creating the animation.

Members (5)

get · iOS 18.0+

linearImpulse

TypeScript
get linearImpulse(): SDKHandle
Swift declaration
var linearImpulse: SIMD3<Float>

An impulse in newton seconds (in physics simulation space).

set · iOS 18.0+

linearImpulse

TypeScript
set linearImpulse(value: SDKHandle)
Swift declaration
var linearImpulse: SIMD3<Float>

An impulse in newton seconds (in physics simulation space).

init · iOS 18.0+

init

TypeScript
static init(targetEntity?: ActionEntityResolution, linearImpulse?: SDKHandle): ImpulseAction
Swift declaration
init(targetEntity: ActionEntityResolution = .sourceEntity, linearImpulse: SIMD3<Float> = [0, 1, 0])

Creates a new impulse action. - Parameters: - targetEntity: The entity that the impulse acts upon. - linearImpulse: The impulse in newton seconds (in physics simulation space).

get · iOS 18.0+

targetEntity

TypeScript
get targetEntity(): ActionEntityResolution
Swift declaration
var targetEntity: ActionEntityResolution

The entity that the impulse acts upon.

set · iOS 18.0+

targetEntity

TypeScript
set targetEntity(value: ActionEntityResolution)
Swift declaration
var targetEntity: ActionEntityResolution

The entity that the impulse acts upon.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

ImpulseAction.animatedValueType

Passing a Swift type itself is not supported.

All RealityFoundation types →