I’m working on a platform style game, using physics for motion and collision of the player and platforms. I want to have some objects like elevators or clouds etc. that slide up and down, left and right. At the moment I’m using Static objects, and using a transition.to() to move them. The motion is of course applied outside of the physics system. As is, everything seems to be working well enough.
I’m trying to come up with a system that gets the same effect using physics. I can make the objects the dynamic, and use setVelocity(), applyForce(), or applyLinearImpulse(), but. Using these you can’t know how far an object has moved, making it difficult to know when to reverse the motion and send the object the other direction. I have been looking at joints wondering if a piston joint might work.