Background for Skyrim SE
Member of the ObjectReference script
voidfunctionSetMotionType(intaeMotionType, boolabAllowActivate=true)Native

[DEV SERVER] Loading description...


Caveats

CK Wiki - Notes

  • When using this function in a script that extends ObjectReference, it is not necessary to prefix Motion_Keyframed and Motion_Dynamic with an ObjectReference property or variable (e.g. Rock), since the these properties are native to the ObjectReference script.
  • If you set an object's motion type to dynamic, it may hang in the air until bumped, even if you pass True as the second argument. To get the object to start falling after having its physics enabled, ObjectReference.ApplyHavokImpulse(...) with a downward force vector (0, 0, 1) and a zero magnitude.

CK Wiki - Known Bugs

  • Certain references have 3D meshes that are incompatible with this function. If a NIF has any bhkCollisionObject with flag 8 set (e.g. 137 & 8 == 8), then references using that NIF will show unstable behavior, of which there are two kinds. Once unstable behavior has occurred, it cannot be reverted through normal means, as there is no way to unset a motion type override.

    • In some cases, only part of the mesh moves; for example, a Noble Wardrobe will separate from its door.
    • In other cases, the mesh will not move, but the game engine will believe that it has moved, reporting incorrect position. Most of the game's non-load doors show this behavior.
    • Sometimes, changes can "bleed over" onto other references that use the same mesh, though only for the life of the session. However, references that are directly affected will remain affected, and the problem will be baked into the user's save.
    • The specific problem is that this flag is, for some reason, incompatible with how the game handles references that have the HAVOK_MOVE changeFlag set. ChangeFlags are used to keep track of what data needs to be written to the user's savegame.

Parameters

intaeMotionType

CK Wiki Description

New Havok motion type. Allowed values are:* Motion_Dynamic = 1: The object will be simulated by havok (fall, etc...). It appears that the engine may automatically set this object to the SphereInertia or BoxInertia motion type.

  • Motion_SphereInertia = 2: "Softened" movement simulation performed using a sphere inertia tensor.
  • Motion_BoxInertia = 3: "Softened" movement simulation performed using a box inertia tensor.
  • Motion_Keyframed = 4: The object will NOT be simulated by Havok (will only move if forced to, through ObjectReference.SetPosition(...) or ObjectReference.TranslateTo(...))
  • Motion_Fixed = 5: This motion type is used primarily for the static elements of a game scene, e.g. the landscape.
  • Motion_ThinBoxInertia = 6: A box inertia motion optimized for thin boxes to have less stability problems.
  • Motion_Character = 7: A specialized motion used for character controllers.

boolabAllowActivate=true

CK Wiki Description

If setting the motion type to Dynamic, whether the object should start simulating right away. Otherwise, it will remain in it location until activated (attacked or Z-keyed, both of which don't apply for objects set to keyframed).

  • Default:True

Examples

; Set the rock to no longer be simulated (it will be frozen in place). The following two statements are equivalent:
Rock.SetMotionType(Rock.Motion_Keyframed)
Rock.SetMotionType(4)
; Set the rock to be simulated, but not to move until touched. The following two statements are equivalent:
Rock.SetMotionType(Rock.Motion_Dynamic, false)
Rock.SetMotionType(1, false)

Auto-Generated Example

int myInt__aeMotionType
bool myBool__abAllowActivate

myObjectReference__toCallFunctionOn.SetMotionType(myInt__aeMotionType, myBool__abAllowActivate)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.