Import sidesign.minib3d Strict Type TCube Field mesh:TMesh End Type Local meshList:TList = New TList Local width=640,height=480,depth=16,mode=2 Const CUBE = 1 Const GROUND_CUBE = 2 Graphics3D width,height,depth,mode Local cam:TCamera=CreateCamera() CameraRange cam,.5,500 PositionEntity cam,5,5,-10 Local light:TLight=CreateLight(1) RotateEntity light,90,0,0 Local ground:TMesh=CreateCube() ScaleMesh ground,10,0.5,3 EntityType ground,GROUND_CUBE PositionMesh ground,5,0,2 For Local loopy = 0 To 10 For Local loopx = 0 To 10 Local newMesh:TCube = New TCube newMesh.mesh = CreateCube() EntityType newMesh.mesh,CUBE ScaleMesh newMesh.mesh,0.5,0.5,0.5 PositionEntity newMesh.mesh,loopx+1,(loopy+33)+1,1 Local brush:TBrush=CreateBrush() BrushColor brush,Rand(100,255),Rand(100,255),Rand(100,255) PaintMesh newMesh.mesh,brush EntityPickMode newMesh.mesh,2 ResetEntity newMesh.mesh meshList.AddLast(newMesh) Next Next ' used by fps code Local old_ms=MilliSecs() Local renders Local fps Collisions CUBE,GROUND_CUBE,2,2 Collisions CUBE,CUBE,2,2 While Not KeyDown(KEY_ESCAPE) If MouseHit(1) Local picked:TEntity = CameraPick(cam,MouseX(),MouseY()) If picked<>Null For Local currentCube:TCube=EachIn meshList If currentCube.mesh = picked HideEntity currentCube.mesh FreeEntity currentCube.mesh meshlist.Remove(currentCube) End If Next End If End If ' control camera MoveEntity cam,KeyDown(KEY_D)-KeyDown(KEY_A),0,KeyDown(KEY_W)-KeyDown(KEY_S) TurnEntity cam,KeyDown(KEY_DOWN)*2-KeyDown(KEY_UP)*2,KeyDown(KEY_LEFT)*2-KeyDown(KEY_RIGHT)*2,0 For Local currentCube:TCube=EachIn meshList MoveEntity(currentCube.mesh,0,-.1,0) Next UpdateWorld RenderWorld Flip Wend End
Basically, I want a grid of cubes to fall onto the ground, then stack nicely on top of each other... To cut a long story short, I've tried entityradius, which half worked, but still wasnt right, and entitybox doesnt appear to do anything, but I'm sure thats just me not understanding the command.
Any pointers where I'm borking it up?
Cheers
Dabz