Blitz3D+ Command Reference

PhysicsFixedJointAngularDamping# ( joint )

Parameters

joint - live fixed-joint handle from CreatePhysicsFixedJoint

Description

Returns the fixed joint's stored dimensionless angular spring damping ratio.

A rigid (zero-frequency) channel uses native constraint tuning instead.

CreatePhysicsFixedJoint captures the initial relative body pose in its rest frames. PhysicsJointFrame can edit either attachment frame. Positive frequencies permit compliant translation and/or rotation; zero frequencies restore rigid channels. Long chains retain finite solver error and can oscillate after changing stiffness. The example uses eight substeps and body damping and shows joint extension with red connectors.

The joint must belong to the matching joint family. All setters validate every argument before mutation and wake connected bodies. Getters do not wake bodies or change physics state. Settings and native wake operations are recorded for deterministic physics replay. Body/entity/world deletion invalidates owned joint handles. Invalid, stale and wrong-kind handles or unsupported joint types raise runtime errors.

Use PhysicsJointForceX/Y/Z and PhysicsJointTorqueX/Y/Z for combined reaction feedback and PhysicsJointThresholds for overload events. Native overloads are sampled during bias solves; final relaxed force/torque getters need not match the event threshold on that step. Events do not automatically break joints.

Requires Extended mode.

See also: CreatePhysicsFixedJoint, PhysicsFixedJointSpring, PhysicsFixedJointLinearHertz, PhysicsFixedJointAngularHertz, PhysicsJointFrame.

Example

; PhysicsFixedJointAngularDamping Example
; ---------------------------------------
; Requires Extended mode.

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

Const PHYSICS_STATIC=0
Const PHYSICS_DYNAMIC=2

camera=CreateCamera()
PositionEntity camera,0,3,-7
RotateEntity camera,20,0,0

light=CreateLight()
RotateEntity light,45,-30,0
AmbientLight 60,60,60

; An independent Box3D world with standard gravity
world=CreatePhysicsWorld()

; Blue static floor
ground=CreateCube()
ScaleEntity ground,6,0.5,6
PositionEntity ground,0,-0.5,0
EntityColor ground,80,160,255
ground_body=CreatePhysicsBody(world,ground,PHYSICS_STATIC)
ground_shape=PhysicsBodyBox(ground_body,12,1,12)

; A sign welded to a static post with a springy fixed joint
post=CreateCube()
ScaleEntity post,0.1,1.5,0.1
PositionEntity post,0,1.5,0
EntityColor post,150,150,160
post_body=CreatePhysicsBody(world,post,PHYSICS_STATIC)
post_shape=PhysicsBodyBox(post_body,0.2,3,0.2)
sign=CreateCube()
ScaleEntity sign,1,0.4,0.05
PositionEntity sign,1.1,2.5,0
EntityColor sign,255,120,70
sign_body=CreatePhysicsBody(world,sign,PHYSICS_DYNAMIC)
sign_shape=PhysicsBodyBox(sign_body,2,0.8,0.1,20)
weld=CreatePhysicsFixedJoint(post_body,sign_body)
hertz#=2
PhysicsFixedJointSpring weld,hertz,0.1,hertz,0.1

While Not KeyDown(1)

    ; Space knocks the end of the sign
    If KeyHit(57)
        TFormPoint 1,0,0,sign,0
        PhysicsBodyImpulseAt sign_body,0,-10,10,TFormedX(),TFormedY(),TFormedZ()
    EndIf

    ; [ and ] make the weld softer or stiffer; 0 Hz is perfectly rigid
    If KeyHit(26) And hertz>0 Then hertz=hertz-0.5
    If KeyHit(27) Then hertz=hertz+0.5
    PhysicsFixedJointSpring weld,hertz,0.1,hertz,0.1
    StepPhysics world,1.0/60.0,4

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    Text 0,0,"Arrow keys: move camera   Space: knock   [ / ]: stiffness   Esc: exit"
    Text 0,20,"PhysicsFixedJointAngularDamping(weld) = "+PhysicsFixedJointAngularDamping(weld)
    Text 0,40,"(linear "+PhysicsFixedJointLinearDamping(weld)+")"

    Flip

Wend

FreePhysicsWorld world
End

Index