Hi!
I'm writing an engine, that is supposed to be open world with object like trees, houses and so,,,, yes, and those are all collidable object.
For the terrain however I've set collision off. It's loaded as a heightmap and relies only on following the countour and uses just math to prevent the player from walking too steep slopes.
As long as the stateObjCol equals 0, meaning no collision will tell the application to use the 'follow countour' routine and that routine works satisfying. ยจ
The problem comes when stateObjCol equals 1. Please look at this code,,,
Collide = sc_SphereCastGroup(1,plyPosX,plyPosY,plyPosZ,plyPosX,plyPosY+2,plyPosZ+1,10,0)
if Collide <> 0
stateObjCol = 1
position object plyObj,sc_getCollisionSlideX(),sc_getCollisionSlideY(),sc_getCollisionSlideZ()
sc_updateObject plyObj
ENDIF
When there's no collision I want the variable get back to 0. I've already tried to check if Collide equals 0 to simply switch back the variable to 0. And the same tries have been done by casting a ray straight down, but the effect of this is that the player moves up a down rapidly as soon as collision occours,,,
Best!
www.memblockgames.com