Sorry to come here again, but this collision detection SHOULD work, but doesn't. It keeps saying
RUNTIME ERROR AT LINE 16: OBJECT DOES NOT EXIST., which confuses me. (Line 16 is the "Next X" command). All I want to do is make the sphere NOT FALL THROUGH THE FLOOR AND GO UP MY HILLS IN THE LEVEL. Does it have to do with I copypasted it from different tuts? I modified the code to where it should work. Here's the code:
Rem Setup Sync
Sync On
Sync Rate 30
Rem Hide Mouse Cursor
Hide Mouse
Rem Load level 1 and objects
For X = 1 to 10
Load Object "C:\Documents and Settings\Jeremy\Desktop\Game Media\Lev1.X",1
XRotate Object 1, 90
ZRotate Object 1, 100
Scale Object 1, 1000,1000,1000
Set Object Collision to boxes X
Next X
Rem Make sphere
Make object sphere 10,10
Color Object 10, rgb(25,245,245)
Set Object Collision To Spheres 10
Rem Main loop
Do
Rem Store Object angle Y in aY#
aY# = Object angle Y(10)
Rem Control input for camera
If Upkey()=1 then Move object 10,10
If Leftkey()=1 then Yrotate object 10,Wrapvalue(aY#-5)
If Rightkey()=1 then Yrotate object 10,Wrapvalue(aY#+5)
If Downkey()=1 then Move Object 10,-10
Rem Detect collision
If Object collision(10,0)>0 then position object 10,X#,0,Z#
Rem get player object position and store in X# and Z#
X# = Object position x(10)
Z# = Object position z(10)
Rem get new camera position and store in cZ# and cX#
cZ# = Newzvalue(Z#,aY#-180,100)
cX# = Newxvalue(X#,aY#-180,100)
Rem position camera
Position Camera cX#,80,cZ#
Rem point the camera at the player object
Point camera X#,50,Z#
Rem Refresh Screen
Sync
Loop
If someone knows how to get collision detection working, please post!!