PhysicsCreateConstraint

From Multi Theft Auto: Wiki
Revision as of 15:10, 19 February 2020 by CrosRoad95 (talk | contribs) (Created page with "__NOTOC__ {{Client function}} Creates connection between rigid body and other rigid body or specified position. ==Syntax== <syntaxhighlight lang="lua"> physics-constraint p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Creates connection between rigid body and other rigid body or specified position.

Syntax

physics-constraint physicsCreateConstraint(constraint-type theConstraintType [, disableCollisionsBetweenLinkedBodies = true], physics-rigid-body rigidBodyA [, physics-rigid-body rigidBodyB], mixed )             

Required Arguments

  • theConstraintType: "pointtopoint", "hidge", "fixed", "slider", see Physics constraints
  • disableCollisionsBetweenLinkedBodies: disable collision between two rigid bodies, useful when rigids are close to each other.
  • rigidBodyA: first rigid body,
  • rigidBodyB: second rigid body, optional, can be replaced with position in some cases.
  • mixed: depends on constraint type

Returns

  • physics world used for simulation.

Example

Spawns capsule and attach invisible line to the rigid body.

local capsule = physicsCreateShape(physics, "capsule", 0.5, 1.2)
local capsulerb = physicsCreateRigidBody(capsule );
physicsCreateConstraint("pointtopoint", capsulerb, 0,0,0)

See Also