Hi, I'm trying to make a platform that would be able to move back and forth between two points. I can get it to move by setting it's position every frame based on the distance between points and the time, but objects sitting on it will fall through it…. I think its because I'm not actually applying forces to the platform, but if I do it that way instead, I cant get it to stay upright when an object is on it.
1) add a controller to the world
2) in that controller, look at the current orientation, position and velocity of the platform
3) apply a force that is proportional to the difference between the current position of the platform, and where you want it to be
4) apply a torque that is proportional to the difference between what you want the orientation to be, and what it is
5) make your platform at least 10x heavier than the things standing on it
For smoother behavior, you probably want to compare the desired position and orientation with "current position + velocity * dt" to get a frame of look-ahead.
Make sure the forces and torques are big enough to drive the platform pretty quickly.
Ok, well I can move the platform around by adding forces to it, but I have a few questions. One, I still cannot get the platform to remain perfectly upright. Two, I dont know what size forces to use to make it move from one point to another in a specific amount of time.
Alright, I've managed to get it to (as far as I can tell), not go anywhere like so:
Vector3 counterAngularVelocity = body.Torque * -(body.Mass);
Vector3 counterVelocity = body.Velocity * -(body.Mass);
From here, I'll apply the forces to move it. I still can't get it to stay perfectly upright though…
It maybe a stupid question, but uts relevant. Is ther any support for one-way interactions? The physx demos has an example of a man on a hoverboard that is very similar to a moving platfrom. With one-way it remains upright, otherwise it falls over. Is this supported?