Difference between revisions of "R3d.World:createFixedJoint"

From GiderosMobile
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
  
 
=== Description ===
 
=== Description ===
Creates a fixed joint. See its [[R3d.FixedJoint|definition]].
+
Creates a fixed joint.
<source lang="lua">
+
<syntaxhighlight lang="lua">
r3d.World:createFixedJoint(bodyA,bodyB,anchorX,anchorY,anchorZ,params)
+
r3d.World:createFixedJoint(bodyA,bodyB,anchorX,anchorY,anchorZ[,params])
</source>
+
</syntaxhighlight>
 +
 
 +
The FixedJoint class describes a fixed joint between two bodies. In a fixed joint, there is no degree of freedom, the bodies are not allowed to translate or rotate with respect to each other. In order to create a fixed joint, you simply need to specify an anchor point (in world-space) to create the FixedJointInfo object.
 +
 
 +
'''Note''' this method will also return a pointer to the FixedJoint object that has been created internally. You will then be able to use that pointer to change properties of the joint and also to destroy it at the end
  
 
=== Parameters ===
 
=== Parameters ===
Line 18: Line 22:
  
 
=== Example ===
 
=== Example ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
world:createFixedJoint(cube01body, cube02body, 0, 0, 0, {isCollisionEnabled=false})
+
world:createFixedJoint(cube01body, cube02body, 0, 2, 0, { isCollisionEnabled=false, } )
</source>
+
</syntaxhighlight>
  
 
{{R3d.World}}
 
{{R3d.World}}

Latest revision as of 08:25, 18 December 2025

Available since: Gideros 2019.10
Class: R3d.World

Description

Creates a fixed joint.

r3d.World:createFixedJoint(bodyA,bodyB,anchorX,anchorY,anchorZ[,params])

The FixedJoint class describes a fixed joint between two bodies. In a fixed joint, there is no degree of freedom, the bodies are not allowed to translate or rotate with respect to each other. In order to create a fixed joint, you simply need to specify an anchor point (in world-space) to create the FixedJointInfo object.

Note this method will also return a pointer to the FixedJoint object that has been created internally. You will then be able to use that pointer to change properties of the joint and also to destroy it at the end

Parameters

bodyA: (b3d body) body A
bodyB: (b3d body) body B
anchorX: (number) anchor x
anchorY: (number) anchor y
anchorZ: (number) anchor z
params: (table) optional any of the followings:

  • isCollisionEnabled (bool)

Example

world:createFixedJoint(cube01body, cube02body, 0, 2, 0, { isCollisionEnabled=false, } )