fastest way to check if entity is on the ground

Blitz3D Forums/Blitz3D Programming/fastest way to check if entity is on the ground

Zmatrix(Posted 2003) [#1]
Ive been messing with player controls for a 3rd person game (Kinda like Rune)

Im using collisionNY() command to see if it was on the ground/floor (to set the animation seq)
;---------
index=countcollisions(entity)
if collsionNY(entity,index)<>0
on_ground=1
else
on_ground=0
endif
;---------
this works aslong as im on a flat plane.
but it doesnt seem to work on ramps., (maybe i need to round the the result to and int?)

Im using the check to set the jump and falling animations ,but when on a ramp it stays in falling seq.

would a linepick be better?

I could just seperate the floor from the level and
just use
if countcollision(floor)>0
on_ground=1
else
on_ground=0
endif
bit of a hassle tho..because the levels are made in maplet ,so I would spend a while picking out face's.


any idea's?

Thanks in advance

Zmatrix


Tom(Posted 2003) [#2]
Check if the collision Y normal is greater than say 0.5, 1.0 would be a flat level normal, .5 would be 30 degrees

Tom


Zmatrix(Posted 2003) [#3]
Thanks Tom

It seems to be workig now.


Zmatrix