Lifts

Blitz3D Forums/Blitz3D Programming/Lifts

Ching(Posted 2006) [#1]
Has anyone managed to achive lifts ( vertically moving platforms ) in a First Person Shooter? and would they be so kind as to divulge how?
I ask because I get a problem, when I'm in collision contact with a lift, I parent the player to the lift so that it moves with the lift, but because of applying gravity I fall into the lift and then get projected upward at about a million miles per frame.
I've tried allsorts of techniques to get round the problem, although none work as truly desired.
Any assistance would be welcome.


danjo(Posted 2006) [#2]
there is an example in the code section which deals with this exactly.
http://www.blitzbasic.com/codearcs/codearcs.php?code=470


jfk EO-11110(Posted 2006) [#3]
I did lifts aka elevators in my engine, although they are still kind of bugous and the code is a mess.

I had the same problems so finally I decided to use an alternative gravity mode when using a lift. The player is then kind of sticked to the lift cabine while it's in action. I a not very happy with this. TO day I'd probably try it again and simply add a collisoin check in both directions: plaver versus platform and platform versus player to make sure the player cannot fall trough the platform with gravity applied. If this works, whtn it's surely the simplest and yet most effective way. ALthough, vertical moving platforms still don't work. They would require some kind of friction simulation, at least as long as no physics engine will do he job anyway.

So I'd try somthing like

Collsions type_player,type_lift,2,2
collsions type_lift,type_player,3,2

Of course, EntityBox must be set for the player mesh in the right size, as well as EntityRadius for both, player and platform. Maybe you also need to move the player slightly up before you start the lift.

After all those wasted hours of debugging a complicated exception-handled elevator I can only suggest: keep it simple and clean.


Shambler(Posted 2006) [#4]
I just use a linepick down from the player and make sure that the player is always a set distance from what is underneath it.

For example when climbing stairs, as each higher or lower step comes underneath the player then the player is raised or lowered smoothly until it reaches the required height.

As for lifts, if the entity under the player is moving then parent the player to it and stop applying gravity to the player. As soon as they step off the lift, re-apply gravity.

The model I use for the player is a sphere on top of a linepick, think of it as a lollypop ^^ and this works well since the sphere never actually comes into contact with the lift ( unless the lift comes down on top of the player, and my code knows that if player sphere collides with lift then the player is being crushed.)

In essence the linepick solves the problem of the player colliding with the lift since it actually stops this from occuring when the player is above the lift.


Ching(Posted 2006) [#5]
Thanks guys, glad I'm not the only one who's seen this.
I'll check out the code example and see if I can fit the concept in to my proggy.


Ching(Posted 2006) [#6]
Danjo, I've looked at the example you pointed me at, Iv'e never seen Blitz3D look like fortran before.
If you could simplify I'd appreciate.
So far the only way I think I can make this work correctly with my proggy (engine?) is to make an entity box ( not collsision! ) around the lift and check if the player is completely within it, and if so the parenting remains hence the player moves with the parent.
Wierd thing is this leads me to another ( yes more ) requests for updates ( perhaps ? , check you guys first ).
If and when a collision takes place wouldn't it be nice to specify which thing moves out of the way ? and how?


Kalisme(Posted 2006) [#7]
Wow... a month ago I wrote some "lift" functions (I was putting together a basic fps engine... then when I formatted my HD... the cd I backed it up on was broke X( )
anywho... I had an odd problem...
My parenting system was pretty small... it consisted of the parenting functions and some motion tweening functions I put in to animate the elevators...
The problem I had was that the players angle would slighty jolt to a differant angle when it landed on one of the platforms :S
it was really odd... does anyone know why this would happen with one platform and not another?
I guess it's not important now... (I'll base the new parenting system off this... total rewrite n_n )
but I'd like to know what I could of been doing wrong so I can avoid it in the future


Ching(Posted 2006) [#8]
Is itpossible that the parent to which the player was being assigned was slightly rotated?

I have managed to solve my problems in a completely different way.
I assign the lift platform to a pivot parent entity slightly above the lift, I then check if the player is within a radius range of the parent and assign it to the parent only if the player is in collision with the lift. It works OK.
I would have used the llinepick method but I hardly had to recode at all in order to use this technique.

Has anyone else noticed the wierd problem of screen streching when assigning the player parenthood to an entity that is not scaled equally? It's really wierd but I reckon that some good screen effects lie in there somewhere.
This could of course just be down to my own coding. lol.