| None. |
|
Returns the linked native Box3D semantic version as a String, currently 0.1.0. Use PhysicsBuildRevision for the exact pinned commit and local native-patch fingerprint. Reading build information does not create a world or alter simulation state. 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. See also: CapturePhysicsProfile, PhysicsProfileTime, PhysicsProfileCounter, PhysicsNativeBytes, PhysicsWorkerCount. |
; PhysicsVersion Example
; ----------------------
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,"PhysicsVersion() = "+PhysicsVersion()
Flip
Wend
FreePhysicsWorld world
End