b3dDestroyConstraint

Destroys physics constraint (joint) and removes it from simulation. Takes constraintHandle (constraint handle from b3dCreatePointConstraint). Returns nothing (void function).

3D Graphics

Parameters & Returns

Parameters

constraintHandle Int

Returns

Void

Quick Summary

Destroys physics constraint (joint) and removes it from simulation. Takes constraintHandle (constraint handle from b3dCreatePointConstraint). Returns nothing (void function).

Technical Exegesis...

Destroys physics constraint (joint) and removes it from simulation. Takes constraintHandle (constraint handle returned from b3dCreatePointConstraint). Returns nothing (void function, no return value). Removes constraint from Jolt physics system, frees constraint memory, makes connected bodies independent again.

This function removes a constraint from the physics simulation, allowing previously connected bodies to move independently.

Example

Example.bam
; Create pendulum with constraint
Local anchor:Int = b3dCreateCube(1, 0, 0)
b3dPositionEntity(anchor, 0, 10, 0)
Local anchorBody:Int = b3dCreatePhysicsBody(anchor, -1, 0.0, 2, 2, 2)

Local weight:Int = b3dCreateCube(1, 0, 0)
b3dPositionEntity(weight, 0, 5, 0)
Local weightBody:Int = b3dCreatePhysicsBody(weight, -1, 1.0, 2, 2, 2)

Local constraint:Int = b3dCreatePointConstraint(anchorBody, weightBody, 0, -1, 0, 0, 1, 0)

; Later: break the constraint to drop the weight
If inpIsKeyDown(VKEY_SPACE)
    b3dDestroyConstraint(constraint)
    constraint = 0  ; Mark as destroyed
EndIf