PhysicsIsElement

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

Returns whatever physics-element exists

Syntax

bool physicsIsElement(physics-element thePhysicsElement)             

Required Arguments

  • thePhysicsElement: physics element: shape, constraint, rigid body, static collision

Returns

True if physics element exists

Example

if shape got destroyed, static collisions, rigid body and its constraints will destroyed too, this example prove it.

local shape = physicsCreateShape(physics, "box", 1)
local rb = physicsCreateRigidBody(shape)
local col = physicsCreateStaticCollision(shape)
local const = physicsCreateConstraint("pointtopoint", rb, 0,0,0)
iprint("isElement before", physicsIsElement(shape), physicsIsElement(rb), physicsIsElement(col), physicsIsElement(const)) -- true, true, true, true
physicsDestroy(shape)
iprint("isElement after", physicsIsElement(shape), physicsIsElement(rb), physicsIsElement(col), physicsIsElement(const)) -- false, false, false ,false

See Also