This is some code that I have been dealing with. It works perfectly, but the collisions don't work. Please help.
Graphics3D 640,480
SetBuffer BackBuffer()
;Set global on font variables
Global fntArial
;Load fonts to a file handle variables
fntArial=LoadFont ("Arial",15,False,False,False)
;Set the font and print text
SetFont fntArial
;Opening title
Print "Explorer program: Press the arrow keys to move forward, backwards, left, and right."
WaitKey
;Create a light
CreateLight()
;Camera
camera=CreateCamera()
RotateEntity camera,45,0,0
;Set up the numbers
type_player=1
type_obstacle=2
;Create the sphere
sphere=CreateSphere ()
PositionEntity sphere,9,4,1
EntityType sphere,type_player
;Textures
tex=LoadTexture ("texture1.jpg")
ScaleTexture tex,.5,.5
EntityTexture sphere, tex
;Create some terrain
ground=LoadTerrain("maze.jpg")
ScaleEntity ground,5,100,5
PositionEntity ground,-500,0,-500
texture2=LoadTexture("texture2.jpg")
EntityTexture ground, texture2
EntityType ground, type_obstacle
Collisions type_player, type_obstacle,5,5
;Begin
While Not KeyDown (1)
If KeyDown (208) TranslateEntity sphere,0,0,-0.3
If KeyDown (200) TranslateEntity sphere,0,0,0.3
If KeyDown (205) TranslateEntity sphere,0.3,0,0
If KeyDown (203) TranslateEntity sphere,-0.3,0,0
If KeyDown (16)=True Then pitch#=pitch#-1
If KeyDown (17)=True Then pitch#=pitch#+1
If KeyDown (18)=True Then yaw#=yaw#-1
If KeyDown (19)=True Then yaw#=yaw#+1
If KeyDown (20)=True Then roll#=roll#-1
If KeyDown (21)=True Then roll#=roll#+1
PositionEntity camera, EntityX(sphere),0,EntityZ(sphere)
MoveEntity camera,0,0,-20
RenderWorld
Flip
Wend
End
Graphics3D 640,480
SetBuffer BackBuffer()
;Set global on font variables
Global fntArial
;Load fonts to a file handle variables
fntArial=LoadFont ("Arial",15,False,False,False)
;Set the font and print text
SetFont fntArial
;Opening title
Print "Explorer program: Press the arrow keys to move forward, backwards, left, and right."
WaitKey
;Create a light
CreateLight()
;Camera
camera=CreateCamera()
RotateEntity camera,45,0,0
;Set up the numbers
type_player=1
type_obstacle=2
;Create the sphere
sphere=CreateSphere ()
PositionEntity sphere,9,4,1
EntityType sphere,type_player
;Textures
tex=LoadTexture ("texture1.jpg")
ScaleTexture tex,.5,.5
EntityTexture sphere, tex
;Create some terrain
ground=LoadTerrain("maze.jpg")
ScaleEntity ground,5,100,5
PositionEntity ground,-500,0,-500
texture2=LoadTexture("texture2.jpg")
EntityTexture ground, texture2
EntityType ground, type_obstacle
Collisions type_player, type_obstacle,5,5
;Begin
While Not KeyDown (1)
If KeyDown (208) TranslateEntity sphere,0,0,-0.3
If KeyDown (200) TranslateEntity sphere,0,0,0.3
If KeyDown (205) TranslateEntity sphere,0.3,0,0
If KeyDown (203) TranslateEntity sphere,-0.3,0,0
If KeyDown (16)=True Then pitch#=pitch#-1
If KeyDown (17)=True Then pitch#=pitch#+1
If KeyDown (18)=True Then yaw#=yaw#-1
If KeyDown (19)=True Then yaw#=yaw#+1
If KeyDown (20)=True Then roll#=roll#-1
If KeyDown (21)=True Then roll#=roll#+1
PositionEntity camera, EntityX(sphere),0,EntityZ(sphere)
MoveEntity camera,0,0,-20
RenderWorld
Flip
Wend
End