Hi everyone, I'm in need of a bit of help...
I have a line of pickable cubes. I want to be able to click any of the cubes and have the others know that the line is broken. For example, say I click cubes 4 and 8, then cubes 1+2+3 will become a separate line, 5+6 will become a separate line, and cubes 9+10 will become a separate line.
The line doesn't have to do anything, just know that it's now separate. Just changing the colours of each cube in a line to match would be great :)
Thanks in advance for any help on this. Here's what I have so far:
I have a line of pickable cubes. I want to be able to click any of the cubes and have the others know that the line is broken. For example, say I click cubes 4 and 8, then cubes 1+2+3 will become a separate line, 5+6 will become a separate line, and cubes 9+10 will become a separate line.
The line doesn't have to do anything, just know that it's now separate. Just changing the colours of each cube in a line to match would be great :)
Thanks in advance for any help on this. Here's what I have so far:
Graphics3D 640,480,0,2 SetBuffer BackBuffer() SeedRnd MilliSecs() HidePointer Global Camera = CreateCamera() Global Light = CreateLight() Global Plane = CreatePlane() Global PlaneTex = CreateTexture (64,64) Color 0,0,100 Rect 0,0,64,64 Color 0,0,150 Rect 0,0,32,32 Rect 32,32,32,32 CopyRect 0,0,64,64,0,0,BackBuffer(),TextureBuffer(PlaneTex) EntityTexture Plane,PlaneTex Type Cube Field X,Y,Z,Mesh,Mark,Picked,Num End Type Local CE.Cube,A For A = 1 To 10 CE.Cube = New Cube CE\Mesh = CreateCube() CE\Mark = CreateCone() CE\X = -10+A*2 CE\Y = 0 CE\Z = 15 CE\Num = A PositionEntity CE\Mesh,CE\X,CE\Y,CE\Z ScaleEntity CE\Mesh,0.9,0.9,0.9 EntityColor CE\Mesh,Rnd(100,200),Rnd(100,200),Rnd(100,200) EntityPickMode CE\Mesh,2 PositionEntity CE\Mark,CE\X,CE\Y+2,CE\Z RotateEntity CE\Mark,180,0,0 ScaleEntity CE\Mark,0.2,0.5,0.2 EntityColor CE\Mark,0,255,0 Next While Not KeyDown (1) If MouseHit (1) CameraPick (Camera,MouseX(),MouseY()) If PickedEntity() <> 0 For CE.Cube = Each Cube If PickedEntity() = CE\Mesh CE\Picked = True EndIf Next EndIf EndIf For CE.Cube = Each Cube If CE\Picked = True EntityAlpha CE\Mesh,0.1 EntityAlpha CE\Mark,0.1 Else EntityAlpha CE\Mesh,1 EntityAlpha CE\Mesh,1 EndIf Next UpdateWorld RenderWorld Color 0,0,255 For CE.Cube = Each Cube CameraProject Camera,CE\X,CE\Y,CE\Z Text ProjectedX(),ProjectedY(),CE\Num,True,True Next Color 255,0,0 Line MouseX()-10,MouseY(),MouseX()+10,MouseY() Line MouseX(),MouseY()-10,MouseX(),MouseY()+10 Flip Wend End