Aligning objects to a terrain

Blitz3D Forums/Blitz3D Programming/Aligning objects to a terrain

yipee! Managed to whip this together, hope it helps.

Graphics3D 800,600
SetBuffer BackBuffer()

light=CreateLight()
ground=CreatePlane()

camera=CreateCamera()

box=CreateCube()
PositionEntity box,0,2,0
PositionEntity camera,0,6,-20
RotateEntity ground,0,0,30
EntityType ground,2
EntityType box,1
Collisions 1,2,2,2


While Not KeyHit(1)

If KeyDown(200) Then MoveEntity box,0,0.1,0
If KeyDown(208) Then MoveEntity box,0,-0.1,0
If KeyDown(203) Then MoveEntity box,0.1,0,0
If KeyDown(205) Then MoveEntity box,-0.1,0,0

If EntityCollided(box,2) Then
	AlignToVector box,CollisionNX(box,1),CollisionNY(box,1),CollisionNZ(box,1),2
End If



UpdateWorld()
RenderWorld()

Flip
Wend
End

bye