PhysicsGetChildShapes

From Multi Theft Auto: Wiki

Returns all child shape of compound shape.

Syntax

table physicsGetChildShapes(physics-shape compoundShape)

Required Arguments

  • compoundShape: Must be compound shape

Returns

Returns table of all shapes. {shape, shape, shape, ...}. False otherwise

Example

Creates something that reminds chain

local compound = physicsCreateShape(physics, "compound")
local capsule = physicsCreateShape(physics, "capsule", 1, 1)
physicsAddChildShape(compound, capsule)
physicsAddChildShape(compound, capsule)
physicsAddChildShape(compound, capsule)
local childShapes = physicsGetChildShapes(compound);
outputChatBox("Your compound shape is made of ".. #childShapes .. " capsules")

See Also