ALIGN OBJECT

Blitz3D Forums/Blitz3D Beginners Area/ALIGN OBJECT

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hey, here's something i found on my computer

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


Align a cube to the plane once it collides :)