KennyUK
14-04-2008 18:36:31
Hi,
I am trying to create a moving platform in a platform game I am developing. This platform will move up and down vertically, and is there to take my character to new parts of the level.
I have implemented the moving of my platform by using a Slider joint and restrict its rotation by using an UpVector joint. However, I have problems when my character stands on the platform because the effects of gravity on my character cause the platform to drop.
Is there an easy method to counteract this gravitional force, so that my platform remains stationary when the character moves onto it? I guess I have to apply some sort of opposing force, but I don't really know where to start with this!
Any tips would be greatly appreciated
albino
15-04-2008 14:06:13
first thing came in my mind was
using code like
force = plat.mass * (target.pos - cur.pos)/(time^2)
no idea if that helps anything
you could use the A = (V1 - V2) / DT formula to calculate how much acceleration you need to reach a special velocity, and then check if the acceleration you got from it is not bigger than a specific max. value
V1 is the velocity the object alerady moves with, V2 is the desired velocity, DT is the timestep, and A the acceleration which you have to multiply with the mass to get a force
you could also not limit A (or use setVelocity), if you want the platform to be able to lift any mass
KennyUK
16-04-2008 16:21:15
Thanks for the replies guys, i ended up setting the acceleration of the joint on every callback, rather than just once when it starts accelerating. This forced the platform to always be moving at the proper rate, and override any external forces.
koirat
13-03-2009 13:52:33
Anybody tried using static geometry when implementing moving platforms. (TreeCollision)
You don't have to add any joints just move body of your platform as you wish.
I'm just trying this idea in my game. So if you got some experience with this technique tell me about it's drawbacks.
melven
14-03-2009 14:31:04
Anybody tried using static geometry when implementing moving platforms. (TreeCollision)
You don't have to add any joints just move body of your platform as you wish.
I'm just trying this idea in my game. So if you got some experience with this technique tell me about it's drawbacks.
I'm not shure if it is a good idea to use static collisions and move them around... you should perhaps ask in the newton forum...
koirat
14-03-2009 21:14:10
Anybody tried using static geometry when implementing moving platforms. (TreeCollision)
You don't have to add any joints just move body of your platform as you wish.
I'm just trying this idea in my game. So if you got some experience with this technique tell me about it's drawbacks.
I'm not shure if it is a good idea to use static collisions and move them around... you should perhaps ask in the newton forum...
Are you sure ?
I think that static geometry in Newton is just a collision object but with infinite mass, so there is less calculation when it comes to physics.
I have implemented such a platforms, one moves vertically and one horizontally, Since my character is sitting on a ray i have got some problems when it comes to horizontal one. No friction so my body is not moving with a platform.
I will do newton forum later on