Blitz3D+ Command Reference

PhysicsBuildRevision$ ( )

Parameters

None.

Description

Returns a string identifying the exact Box3D build and its local patches.

Returns a String containing the native pinned commit followed by +blitz3d. and a 16-hex-character SHA-256 prefix derived from the sorted local Box3D patch-file contents. The build regenerates this fingerprint when patch inputs change.

This identifies native source-patch inputs. It is not a hash of the executable, wrapper C++ changes, application script or render assets. Include it with PhysicsVersion and PhysicsIsDoublePrecision in physics bug reports. Reading it has no simulation side effects.

World arguments must be live explicit physics worlds; invalid, stale and wrong-kind handles raise a runtime error. Metric indices are one-based and checked before returning values. Captures are rejected while the world is stepping.

Requires Extended mode.

See also: CapturePhysicsProfile, PhysicsProfileTime, PhysicsProfileCounter, PhysicsNativeBytes, PhysicsWorkerCount.

Example

; PhysicsBuildRevision Example
; ----------------------------
; Requires Extended mode.

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

Const PHYSICS_STATIC=0
Const PHYSICS_DYNAMIC=2
Const MAX_CRATES=20

SeedRnd MilliSecs()

camera=CreateCamera()
PositionEntity camera,0,5,-12
RotateEntity camera,15,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 static hook, and a lamp that swings from it on a ball joint
hook=CreateCube()
ScaleEntity hook,0.2,0.2,0.2
PositionEntity hook,0,6,0
hook_body=CreatePhysicsBody(world,hook,PHYSICS_STATIC)
hook_shape=PhysicsBodyBox(hook_body,0.4,0.4,0.4)
lamp=CreateSphere(12)
ScaleMesh lamp,0.4,0.4,0.4
PositionEntity lamp,1.5,4,0
EntityColor lamp,255,230,120
lamp_body=CreatePhysicsBody(world,lamp,PHYSICS_DYNAMIC)
bulb_shape=PhysicsBodySphere(lamp_body,0.8)
cord=CreatePhysicsBallJoint(hook_body,lamp_body,0,6,0)

; The shade is a second shape on the lamp's body
shade=CreateCone(12,True,lamp)
ScaleEntity shade,0.6,0.3,0.6
PositionEntity shade,0,0.5,0
shade_shape=PhysicsBodyBox(lamp_body,1.2,0.6,1.2,1,0,0.5,0)

Dim crates(MAX_CRATES)
Dim crate_bodies(MAX_CRATES)
Dim crate_shapes(MAX_CRATES)

While Not KeyDown(1)

    ; Space drops a crate
    If KeyHit(57) And count<MAX_CRATES
        count=count+1
        crates(count)=CreateCube()
        ScaleEntity crates(count),0.4,0.4,0.4
        EntityColor crates(count),255,120,70
        crate_bodies(count)=CreatePhysicsBody(world,crates(count),PHYSICS_DYNAMIC)
        crate_shapes(count)=PhysicsBodyBox(crate_bodies(count),0.8,0.8,0.8)
        ResetPhysicsBody crate_bodies(count),Rnd(-3,3),5,Rnd(-3,3),0,Rnd(Pi),0
    EndIf

    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

    ; Draw the lamp's cord from the hook
    CameraProject camera,0,6,0
    hook_x=ProjectedX()
    hook_y=ProjectedY()
    CameraProject camera,EntityX(lamp),EntityY(lamp),EntityZ(lamp)
    Line hook_x,hook_y,ProjectedX(),ProjectedY()

    Text 0,0,"Arrow keys: move camera   Space: drop a crate   Esc: exit"
    Text 0,20,"PhysicsBuildRevision() ="
    Text 0,40,PhysicsBuildRevision()
    Text 0,60,"(the pinned Box3D commit, then a fingerprint of local patches)"

    Flip

Wend

FreePhysicsWorld world
End

Index