ArcBasicDocs
3DPhysicsArcBasic extension

PhysicsDebug

Shows the shapes of physics bodies.

PhysicsDebug [enable]

Parameters

enable (optional)
True (the default) shows the shapes; False hides them

Description

Shows the shape of every physics body as an outline, to check that shapes are where they should be.

Static bodies are grey, dynamic bodies green (dark green while asleep), kinematic bodies blue and triggers yellow. The outlines follow the bodies at each UpdateWorld.

Example

PhysicsDebug.absOpen in editor
; Physics shapes example (an ArcBasic extension); A table made of five boxes, and a ball that rolls under it. D shows the shapesGraphics3D 640,480SetBuffer BackBuffer()camera=CreateCamera()PositionEntity camera,0,4,-9TurnEntity camera,20,0,0light=CreateLight()RotateEntity light,50,30,0ground=CreatePlane()EntityColor ground,80,120,80EntityPhysics ground,1; the table is a pivot with a top and four legs as children, for looks...table=CreatePivot()top=CreateCube(table) : ScaleEntity top,2,.1,1 : PositionEntity top,0,2,0For x=-1 To 1 Step 2	For z=-1 To 1 Step 2		leg=CreateCube(table) : ScaleEntity leg,.1,1,.1 : PositionEntity leg,x*1.8,1,z*.8	NextNextEntityColor top,160,110,60PositionEntity table,0,3,0TurnEntity table,0,20,8; ...and one body built from five boxes, so there is room underneathEntityPhysics table,2,5EntityShape table,1,4,.2,2,0,2,0For x=-1 To 1 Step 2	For z=-1 To 1 Step 2		AddEntityShape table,1,.2,2,.2,x*1.8,1,z*.8	NextNextball=CreateSphere(12)ScaleEntity ball,.4,.4,.4PositionEntity ball,-6,.4,0EntityColor ball,250,200,60EntityPhysics ball,2debug=FalseWhile Not KeyHit(1)	If KeyHit(57) Then SetEntityVelocity ball,6,0,0	If KeyHit(32)		debug=Not debug		PhysicsDebug debug	EndIf	UpdateWorld	RenderWorld	Text 0,0,"Space: roll the ball   D: show the physics shapes"	FlipWendEnd

See also