PhysicsGetChildShapeOffsets

From Multi Theft Auto: Wiki
Revision as of 18:08, 12 February 2020 by CrosRoad95 (talk | contribs) (Created page with "__NOTOC__ {{Client function}} Returns offset position and rotation of child shape. Sometimes return number is slightly different than input! ==Syntax== <syntaxhighlight lan...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Returns offset position and rotation of child shape. Sometimes return number is slightly different than input!

Syntax

float float float float float float physicsGetChildShapeOffsets(physics-shape compoundShape, int index)

Required Arguments

  • compoundShape: Must be compound shape
  • index: Index of child. Starts from 1.

Returns

Returns offset position ( x,y,z ) and rotation (rx,ry,rz) of child shape. False otherwise

Example

Creates something that reminds chain

local compound = physicsCreateShape(physics, "compound")
local capsule = physicsCreateShape(physics, "capsule", 1, 1)
physicsAddChildShape(compound, capsule,1,2,3,4,5,6)
x,y,z,rx,ry,rz = physicsGetChildShapeOffsets(compound, 1)
outputChatBox("Offset of first shape: ".. string.format("%.2f,%.2f,%.2f,%.2f,%.2f,%.2f", x,y,z,rx,ry,rz))

See Also