PhysicsIsElement

From Multi Theft Auto: Wiki
Revision as of 19:16, 19 February 2020 by CrosRoad95 (talk | contribs) (Created page with "__NOTOC__ {{Client function}} Returns whatever physics-element exists ==Syntax== <syntaxhighlight lang="lua"> bool physicsIsElement(physics-element thePhysicsElement)...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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