linearImpulse
TypeScriptget linearImpulse(): SDKHandleSwift declarationvar linearImpulse: SIMD3<Float>An impulse in newton seconds (in physics simulation space).
struct · iOS 18.0+ · SDK 27.1
struct ImpulseActionAn 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.
get linearImpulse(): SDKHandleSwift declarationvar linearImpulse: SIMD3<Float>An impulse in newton seconds (in physics simulation space).
set linearImpulse(value: SDKHandle)Swift declarationvar linearImpulse: SIMD3<Float>An impulse in newton seconds (in physics simulation space).
static init(targetEntity?: ActionEntityResolution, linearImpulse?: SDKHandle): ImpulseActionSwift declarationinit(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 targetEntity(): ActionEntityResolutionSwift declarationvar targetEntity: ActionEntityResolutionThe entity that the impulse acts upon.
set targetEntity(value: ActionEntityResolution)Swift declarationvar targetEntity: ActionEntityResolutionThe entity that the impulse acts upon.
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.