AddHavokBallAndSocketConstraint - Game

From the CreationKit Wiki
Jump to navigation Jump to search

Member of: Game Script

Adds a constraint between two rigid bodies of two references

Syntax[edit | edit source]

bool Function AddHavokBallAndSocketConstraint(ObjectReference arRefA, string arRefANode, ObjectReference arRefB, string arRefBNode, \
    float afRefALocalOffsetX = 0.0, float afRefALocalOffsetY = 0.0, float afRefALocalOffsetZ = 0.0, float afRefBLocalOffsetX = 0.0, \
    float afRefBLocalOffsetY = 0.0, float afRefBLocalOffsetZ = 0.0) native global

Parameters[edit | edit source]

  • arRefA: The first reference
  • arRefANode: The rigid body name on the first reference for the constraint
  • arRefB: The second reference
  • arRefBNode: The rigid body name on the second reference for the constraint
  • afRefALocalOffsetX: The offset of the constraint in the first body's space, X
    • Default: 0.0
  • afRefALocalOffsetY: The offset of the constraint in the first body's space, Y
    • Default: 0.0
  • afRefALocalOffsetZ: The offset of the constraint in the first body's space, Z
    • Default: 0.0
  • afRefBLocalOffsetX: The offset of the constraint in the second body's space, X
    • Default: 0.0
  • afRefBLocalOffsetY: The offset of the constraint in the second body's space, Y
    • Default: 0.0
  • afRefBLocalOffsetZ: The offset of the constraint in the second body's space, Z
    • Default: 0.0

Return Value[edit | edit source]

True on success.

Examples[edit | edit source]

; Add a ball and socket constraint between bob and sally's hand nodes
Game.AddHavokBallAndSocketConstraint(Bob, "Hand", Sally, "Hand")


; Add a ball and socket constraint between bob and sally's hand nodes with an offset of 1,1,1 in the first body's space
Game.AddHavokBallAndSocketConstraint(Bob, "Hand", Sally, "Hand", 1.0, 1.0, 1.0)

Notes[edit | edit source]

  • The nodes referenced must contain a bhkCollisionObject node, which in turn must contain a bhkRigidBody node.
  • You can only add a ball and socket constraint on dead actors, or live actors that are in the process of "ragdolling" from PushActorAway or some other physics impact. When the live actor gets back up, the constraint will be broken.

See Also[edit | edit source]