PhysicsCreateConstraint

From Multi Theft Auto: Wiki
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