I managed to create my own simple crouching system, good or not, it seems to work reasonably well.
Anyway, the thing I'm asking is, how can I prevent the player from automatically standing up, or in that case, stand up at all, when he or she is under something?
Here's the crouch code:
if keystate(29)=1
rem and third=0
position camera object position x(2),object position y(2)+2.5,object position z(2)
scale object 2,1,1,1
collide = sc_SphereCastGroup(1,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#/1.5,0)
if shiftkey()=0 then sprint=sprint+2
endif
if keystate(29)=0
rem and third=0
position camera object position x(2),object position y(2)+5,object position z(2)
scale object 2,1,1,1
collide = sc_SphereCastGroup(1,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
if shiftkey()=0 then sprint=sprint+1
endif
No need to clean it up, it seems to be fine for me.
Also, I'm guessing the answer lies with ray casting, but I'm not sure what that is so if that is what I'm gonna have to do considering I have Sparky's DLL, then I'd like a bit of help with it so I can understand it.