I thought this would have been asked before, but i can't find anything about this.
I've made a simple platform, added it as a kinematic object, and made a route for it that moves it in a vertical direction (Just a waypoint system with a low and high position in ping-pong mode). Up and down, like an elevator.
Now there are two issues with this. The first is that most of the time, when my player is standing on top of the platform, he doesn't get "picked up" when the platform starts going up. It can't be a problem with the physx mesh because sometimes it does work and my character stays on the platform while it is moving up.
Another issue is when the platform is going down again. The player's gravity seems to catch up a bit too slowly. So he's constantly bouncing down bit by bit. I could alter the player mass perhaps, but that would also have an impact on movement in the rest of the world.
Am I thinking the wrong way about this? If anyone has successfully implemented an elevator system, I'd like to know how it should be done.
This is the code i used for now (overriding Kinematic create & update)
It looks like the platform itself is shaking here, but that's because the camera follows the player. The bouncing happens if I move around the player on the platform too.
I don't think there's something wrong here. I probably have to adjust some physics setting on the character while i'm on the platform, but i don't know which one.
(This post was last modified: 12-20-2010 03:28 PM by yvanvds.)
Sorry for the delay, I was making a new gameworld after a certain unfortunate event last week
I checked out your example, and it works ok. But! Almost nothing happens in that example. I tried to make it more like full blown world by adding a few hundred trees with lights between them. I also doubled the platform speed:
Now the 'effect' is also happening your code. It might depend on how good your graphics card is, but i think you'll see it when you add enough trees and lights. (In my case, framerate was 500 at first, and 35 after adding the trees and lights, about the same framerate as in my game.)
Ok, with PHYS_TIMESTEP_ROUND it helps to set Physics.precision() below the actual framerate, but that makes me fall through the terrain when I jump, about one time out of three. I'll also don't know yet what the effect will on other game objects, but falling through the terrain is not really a workable option.
PHYS_TIMESTEP_VARIABLE doesn't really help, the bouncing is the same at every precision when I use it.
That didn't help, but ok, I found a workaround. To wrap it up: the bumping on the platform happens when the framerate is less than twice the physics precision. Just lowering the physics precision is not an option because it makes object movement in general less smooth than it schould be.
The code below takes care of that, albeit in a bit of a crude way:
In the player update function (AG_ELEVATOR is a custom actor group):