Description
Wiki Description
Applies a Havok impulse force to this object of the specified direction and magnitude.
Documentation Comment
Apply an impulse to this reference
Caveats
CK Wiki - Notes
This function correctly moves the graphics and collision geometry, but the object is still considered to be on its old position. This creates a few problems:
- If you use SetPosition or MoveTo on the object, it will blink (return to its original position, then to its new position again).
- If your object's original position is now a few cells away from the player, it will be unloaded by the game even if its graphics and collision box are close to the player. A workaround is to periodically translate your object to "self" through ObjectReference.TranslateToRef(...). This will not translate the mesh and collision geometry. However, if the translation completes, the position will be updated and you will see the object's mesh blink. To address this, you need to use OnTranslationAlmostComplete and dynamically adjust the speed so that your object never reach itself.
- ObjectReference.GetPositionX() and ObjectReference.GetAngleX() will return the old position. If you need those informations, a workaround is to have a dummy, invisible, object and use MoveToNode to move it to one of your real object's nodes, then get the position of your dummy object. (source)
Aside from that, this function will fail and throw a Papyrus warning if the reference has no 3D or if a zero-length force vector is used. Otherwise, the force vector will be normalized before the force is applied. A zero magnitude is permitted and force will still be applied (i.e. you won't displace the object, but you'll trigger Havok settling and any other side-effects of it being bumped).
Parameters
floatafX
CK Wiki Description
X component of the force vector.
floatafY
CK Wiki Description
Y component of the force vector.
floatafZ
CK Wiki Description
Z component of the force vector.
floatafMagnitude
CK Wiki Description
The magnitude of the force vector - how hard to hit this object.
Examples
; Apply a physical force along the x axis with a magnitude of 5 to a cheese wheel
CheeseWheel.ApplyHavokImpulse(1.0, 0.0, 0.0, 5.0);sends testaxe, a heavy object, flying across room
;along the positive y-axis
testAxe.ApplyHavokImpulse(0.0, 1.0, 0.0, 10000.0); launch the skeever up into the air
Game.GetPlayer().PushActorAway(Skeever, 0.0)
Skeever.ApplyHavokImpulse(0.0, 0.0, 1.0, 1000.0)Auto-Generated Example
float myFloat__afX
float myFloat__afY
float myFloat__afZ
float myFloat__afMagnitude
myObjectReference__toCallFunctionOn.ApplyHavokImpulse(myFloat__afX, myFloat__afY, myFloat__afZ, myFloat__afMagnitude)