ArcBasicDocs

help/commands/3d_examples

AddEntityShape.abs

57 lines of ArcBasic. Words in colour that are commands link to their help page. To run it, download ArcBasic, open the file and press F5.

Download AddEntityShape.absAll files in this folder

AddEntityShape.abs
; 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