Well, I have my 3d platformer code goin pretty well, but I've been working for 2 and a half weeks on just this problem and I can't solve it no matter how many things I try. I have one object, a tall platform, that I want my main object to collide with and slide down as if its being pulled by normal gravity. But because of the way NGC handles sliding collision, when it collides it gets pushed back very minutely, but that means for one or two cycles the main object is not colliding with anything. This resets my gravity=gravity-0.3 variable over and over, so gravity only ever equals 0.3. Is there any way that I could make gravity carry over so no matter if its colliding or not colliding it will always be adding up?
sync on:sync rate 60
REM All the pretty variables
global speedr#
global speedl#
global posx#
global posy#
global posz#
global jumpy#
global jumped
global gravity#=0.3
global obj
global obytwo
global objsx#
global mnobjx#
global rtc#
global ltc#
global mainobjs#
global objlftc#
make object sphere 1, 2
position object 1, 0, 0, 50
make object box 2, 50, 0.5, 10
position object 2, 0, -1.2, 0
make object box 3, 4, 1, 4
position object 3, 6, 1, 0
make object box 4, 3.5, 5, 4
position object 4, -5, 2, 0
make object box 24, 0, 5, 4
position object 24, -3, 2, 0
REM Nuclear Glory Stuff
#Constant NCULL_COUNTER_CLOCK 1
#Constant NCULL_CLOCK 2
#Constant NCULL_NONE 3
#Constant TYPE_NGC_ELLIP=1
#Constant TYPE_NGC_MESH=2
#Constant ELLIP_2_ELLIP=1
#Constant ELLIP_2_POLY=2
#Constant RESP_STICK=1
#Constant RESP_SLIDE=2
#Constant RESP_SLIDE_NO_SLOPES=3
#Constant RESP_SLIDE_NO_GRAV=4
#Constant RESP_SLIDE_NO_ACCEL=5
#Constant RESP_NONE=6
#Constant DYN_NO_RESP=1
#Constant DYN_RESP=2
#Constant DYN_RESP_NOTURN=3
#Constant TYPE_SPH_OBJ=1
#Constant TYPE_FLOOR_BOX=2
#Constant TYPE_BLOCK_ONE=3
#Constant TYPE_ENEMY_BOX=4
#Constant EnemyBoxR=24
StartCollisionPRO(000000000,000000000,000000000)
StartCollisionDebugPRO()
SetCollisionsPRO( TYPE_SPH_OBJ, TYPE_FLOOR_BOX, ELLIP_2_POLY, RESP_SLIDE_NO_ACCEL, DYN_NO_RESP, 0 )
SetCollisionsPRO( TYPE_SPH_OBJ, TYPE_BLOCK_ONE, ELLIP_2_POLY, RESP_SLIDE_NO_ACCEL, DYN_NO_RESP, 0 )
SetCollisionsPRO( TYPE_SPH_OBJ, TYPE_ENEMY_BOX, ELLIP_2_POLY, RESP_SLIDE_NO_ACCEL, DYN_NO_RESP, 0 )
SetCollisionsPRO( TYPE_SPH_OBJ, EnemyBoxR, ELLIP_2_POLY, RESP_SLIDE, DYN_NO_RESP, 0 )
CollisionTypePro( 1, TYPE_SPH_OBJ )
CollisionTypePro( 2, TYPE_FLOOR_BOX )
CollisionTypePro( 3, TYPE_BLOCK_ONE )
CollisionTypePro( 4, TYPE_ENEMY_BOX )
CollisionTypePro( 24, EnemyBoxR )
SetObjRadiusPRO( 1, 1, 1, 1 )
SetCollisionExclusive( 1 )
REM End Nuclear Glory stuff
gravity=gravity-0.01
do
coll()
keyctrl()
REM make camera follow character
position camera object position x(1), 5,-20
print "FPS: ", str$(screen FPS())
print "right speed: ", speedr#
print "left speed: ", speedl#
print "jumpy#: ", jumpy#
print "gravity#: ", gravity#
print "objsx#: ", objsx#
print "mnobjx#: ", mnobjx#
print "rtc#: ", rtc#
print "objlftc: ", objlftc#
RunCollisionPRO()
sync
loop
REM Controls
function keyctrl()
REM move right
if rightkey()=1
speedr#=speedr#+.003
else
speedr#=speedr#-.003
endif
REM move left
if leftkey()=1
speedl#=speedl#+.003
else
speedl#=speedl#-.003
endif
REM jumping
if spacekey()=1 and jumped=0
jumped=1
gravity#=0.3
endif
if jumped=1
jumpy#=object position y(1)+gravity#
endif
REM limit speed
if speedr#=>0.3 then speedr#=0.3
if speedl#=>0.3 then speedl#=0.3
if speedr#=<0.0
speedr#=0.0
endif
if speedl#=<0.0
speedl#=0.0
endif
PositionObjectPRO( 1,object position x(1)+speedr#-speedl#,jumpy#,0)
endfunction
function coll()
CollCount=CountCollisionsPro(1)
oby#=object position y(1)
if CollCount>0
Obj=CollisionHitObj(1,1)
mainobjs#=object size x(1)/2.0
objlftc#=object position x(1)-mainobjs#
objsx#=object size x(obj)/2.0
rtc#=object position x(obj)+objsx#
ltc#=object position x(obj)-objsx#
obytwo#=object position y(obj)
mnobjx#=object position x(1)
if Obj>1 and obj<20 and oby#>obytwo#
gravity#=0.0
jumped=0
else
gravity#=-0.01
endif
if objlftc#=rtc#
speedl#=0.0
endif
if obj=24 and leftkey()=1 then gravity=gravity-0.01
endif
if CollCount=0
gravity#=gravity#-0.01
jumped=1
endif
endfunction
Thanks
Neeeeeeeewom!