tilting

Blitz3D Forums/Blitz3D Beginners Area/tilting

StevieG's solution works fine. I used it for a car demo i was doing. It basicaly aligns the axis's of the car to the collision normal. You don't even need to use a pick command. This just uses collison normals

Use arrow keys to move block into the slope. It will align to the ramp

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(205) Then MoveEntity box,0.1,0,0
If KeyDown(203) Then MoveEntity box,-0.1,0,0
If KeyDown(2) Then TranslateEntity box,0,0.1,0
If EntityCollided(box,2) Then
	AlignToVector box,CollisionNX(box,1),CollisionNY(box,1),CollisionNZ(box,1),2
	temp=CollisionNZ(box,1)
	col=1
Else
	col=0
End If



UpdateWorld()
RenderWorld()

Text 0,0,"normalx="+temp
Flip
Wend
End