can someone please tell me how to fix this? for some reason, if i'm on a loop de loop, and facing left or right, and attempt to fall off the loop de loop, my player object spins and goes real crazy...
Rem Project: loop
Rem Created: Tuesday, May 18, 2010
global coll
global gravity#=2.5
Rem ***** Main Source File *****
sync on
sync rate 60
autocam off
position camera -200,200,-200
`load loopy world
load object "loop.dbo",1
yrotate object 1,90
sc_setupcomplexobject 1,1,2
`make a 'person'
global height as float
height=100
make object box 2,height/3,height,height/6
position object 2,0,height/2+100,0
set shadow shading on 2
set shadow position -1,-100,500,-100
REM NEW!!!
global camang as float
DO
`if object angle x(2) > 0 and object angle x(2) <= 180
player()
`else
`regplay()
`endif
set camera to follow object position x(2),object position y(2),object position z(2),camang,200,4,20,1 REM EDITED!!!
text 10,10,"x:"+str$(object angle x(2))
text 10,30,"y:"+str$(object angle y(2))
text 10,50,"z:"+str$(object angle z(2))
text 10,70,"coll:"+str$(coll)
sync
LOOP `pardon the pun :)
function player()
move object down 2,gravity#
REM Move player
if keystate(17)
move object 2,height/6
turn object right 2,90
move object 2,height/45
turn object left 2,90
endif
if keystate(31)
move object 2,-height/6
turn object right 2,90
move object 2,-height/45
turn object left 2,90
endif
REM Do ground check
`get start and end points for ray cast
oldx#=object position x(2)
oldy#=object position y(2)
oldz#=object position z(2)
pitch object down 2,90
move object 2,height
newx#=object position x(2)
newy#=object position y(2)
newz#=object position z(2)
move object 2,-height
pitch object up 2,90
`do the ray cast
coll=sc_raycastgroup(1,oldx#,oldy#,oldz#,newx#,newy#,newz#,0)
if coll<>0
`get collision data
nx#=sc_getcollisionnormalx()
ny#=sc_getcollisionnormaly()
nz#=sc_getcollisionnormalz()
`make an adjustment to z normal (cheating a bit here to make it work)
d#=sc_getcollisiondistance()
`adjust player angle to suit
point object 2,object position x(2)+nx#,object position y(2)+ny#,object position z(2)+nz#
`move 'up' to half height above ground
move object 2,(height/2)-d#
`re-adjust direction
pitch object down 2,90
if ny#<1.0 and nz#<0 then turn object right 2,180
endif
if keystate(30)
dec camang
endif
if keystate(32)
inc camang
endif
turn object right 2,camang
endfunction
function regplay()
move object 2,(keystate(17)-keystate(31))*4
endfunction
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/