PhysicsGetChildShapeOffsets: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(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...")
 
No edit summary
 
Line 18: Line 18:
==Example==
==Example==


Creates something that reminds chain
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local compound = physicsCreateShape(physics, "compound")
local compound = physicsCreateShape(physics, "compound")

Latest revision as of 19:41, 12 February 2020

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

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