i've looked and it all looks the same to me, well when i say it looks the same, i mean i can't see any reason as to why it shouldn't work
my folder looks like this
and my code is this
sync on
sync rate 60
set display mode 1600,900,32
autocam off
set image colorkey 0,0,0
color backdrop 0
global radius# as double float : radius# = 8.0
makelevel()
makeplayer()
`player movement vector
global vx# as double float
global vy# as double float
global vz# as double float
global gravity# as double float : gravity# = -0.1
global slope# as double float : slope# = 0.5
global ground as integer : ground = 1
`Start main loop
do
position mouse 800,450
moveplayer()
HandleCamera()
`Debug information
set cursor 0,0
print "x:";object position x(2)
print "y:";object position y(2)
print "z:";object position z(2)
print "camera x:";camera position x(0)
print "camera y:";camera position y(0)
print "camera z:";camera position z(0)
print "angle :";object angle Y(2)
sync
loop
function makelevel()
load object "F:\Game Creation\Dark Basic Pro\Projects\thingy\model.dbo",1
set object cull 1,0
sc_setupcomplexobject 1,1,2
sc_allowobjectscaling 1
scale object 1,20,20,20
endfunction
`FUNCTIONS
function makeplayer()
make object sphere 2,radius#*2.0
`position object 2,-50,23,70
position object 2,0,133,0
sc_setupobject 2,0,1
endfunction
function moveplayer()
yrotate object 2,object angle y(2)+mousemovex()/3
xrotate object 2,object angle x(2)+mousemovey()/3
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
angy# = object angle y(2)
vx# = 0
vz# = 0
if vy#=0 then vy# = vy# + 10*gravity# else vy# = vy# + gravity#
if keystate(32)=1 then vx# = vx# + cos(angy#) : vz# = vz# - sin(angy#)
if keystate(30)=1 then vx# = vx# - cos(angy#) : vz# = vz# + sin(angy#)
if keystate(31)=1 then vx# = vx# - sin(angy#) : vz# = vz# - cos(angy#)
if keystate(17)=1 then vx# = vx# + sin(angy#) : vz# = vz# + cos(angy#)
x#=oldx#+vx#
y#=oldy#+vy#
z#=oldz#+vz#
collide = sc_spherecastgroup(1,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
if collide>0
ny# = sc_getCollisionNormalY()
if abs(ny#)>slope#
`Flat ground
oldy# = sc_getStaticCollisionY()
else
`Steep slope, cause to slide
x# = x# - oldx# : z# = z# - oldz#
oldx# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
oldz# = sc_getCollisionSlideZ()
x# = x# + oldx# : z# = z# + oldz#
endif
`ny#<0 means the player has hit a ceiling rather than a floor
if ny#>slope#
`only on ground if standing on flat ground
ground = 1
vy# = 0
else
ground = 0
`If player has hit a flat ceiling then stop vy# movement
if ny#<-slope# then vy# = gravity#
endif
else
`Nothing below player, not on ground, add vertical speed to player
oldy# = oldy# + vy#
ground = 0
endif
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,oldy#,z#,radius#,0)
if collide>0
`If hit, reposition player, stop movement
x# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
endif
position object 2,x#,oldy#,z#
sc_updateObject 2
sc_updateobject 1
endfunction
Function HandleCamera()
`Start the camera oriented with the player and then move it backwards
position camera 0,object position x(2),Object position y(2)+80,object position z(2)
rotate camera 0,object angle x(2)+30,object angle y(2),object angle z(2)
`move camera 0,-30
`We want the camera to slide along any face it hits, so we use SC_sphereSlideGroup to slide a sphere with a radius of 1
`from the player's position to the camera's position (we'll change the camera's position if there's a hit, of course).
Collision=SC_sphereSlideGroup(1,object position x(2),object position y(2),object position z(2),camera position x(0),camera position y(0),camera position z(0),1,0)
`If there was a collision, position the camera at the sliding collision point
if Collision
position camera 0,SC_getCollisionSlideX(),SC_getCollisionSlideY(),SC_getCollisionSlideZ()
point camera 0,Object position x(2),Object position y(2),object position z(2)
endif
endfunction
Windows 7 64 bit, AMD Phenom II x4 Black edition, 4 GB Ram, Radeon HD 4650, 540 GB HDD
I can see from your smile, you're not here for the sunset.