FPSTEST and Stairs / Ramps
Blitz3D Forums/Blitz3D Programming/FPSTEST and Stairs / Ramps
| ||
I am a bit confused. I am using Rob Cumming's FPSTEST with a level I have exported to B3D from Cartography Shop 4.1. I am able to walk around the level and the collision with various objects and the flooris working but stairs and ramps are not working at all. The player (camera) just stops when it enounetrs a ramp or stairs. The code used to check for steps and flooring is: ;steps and floor collisions pick=LinePick (EntityX(player),EntityY(player),EntityZ(player),0,-playerheight,0) If pick PositionEntity player,EntityX(player),PickedY()+playerheight#,EntityZ(player) vy=0 EndIf vy=vy-.2 vy=vy*0.9 HelP() |
| ||
What sort of collision are you using for the player. I've noticed that if you aren't usine a sphere (or very close to a perfect sphere) that the players won't slide over tiny "rifts" in geometry. Of course also for stairs, each step must be smaller than the radius of the sphere. |
| ||
OKay, here is my sample project. Any advice is greatly appreciated! http://www.geocities.com/stevev4v/test.zip Use WASD to walk around. :) Thanks! |
| ||
vy=vy*0.9 Why are you making y velocity increasingly smaller(or am I reading that incorrectly?)? |
| ||
Not sure, as I said in my first post, this is a pared-down version of a demo released by Rob Cummings called FPSTEST. This version that is in my zip archive just has the shooting code removed as my game doesn't use any of that. I didn't develop this source and that is probably why I cannot understand why ramps and stairs do not work. |
| ||
There are several methods you can use to implement gravity, and there are seeral examples, just like the on you mentioned. Personally I think this one is probably not the one with no complication. Maybe you better start with your very own system, so you always know what's going on. Try something like translateentity player,0,-.1,0 And of course, this is only a beginning, later you probably will use things like grav#=-.1 ... while gameloop if linepick(entityx(player),entityy(player),entityz(player),0,-player_height#,0)<> floor then translateentity player,0,grav#,0 if grav#>-1.5 then grav=grav*1.1 ; acceleration while falling else grav#=-.1 endif ... this way it will be easier to implement an independent jumping function, btw. An other thing is, sometimes your level design doesn't fit with the desired Player collision radius, eg. the steps of a stairway could be too big. In such a case I'd suggest not to waste too much time and simply put an invisible (entityalpha) quad onto the stairs, so it will become a ramp. |
| ||
Fixed version up! the old version had bad code for setting up pickable geometry. This version solves the problem and adds a comment. I am also changing the original source to reflect this now... :) |
| ||
Oh yeah - thanks to beaker for the nextchild function which makes looping through children very easy. |
| ||
Thanks VERY much! I really appreciate you taking the time to help me out. I really do. :) Cheers. Steve |