The player is presented with a maze. They draw the path they want to take and then watch an object follow that path through the maze (right now the object moves by lerping transform.position between waypoints – the player can also control the speed while it goes through the maze). I want to add some obstacles that would require physics, so I figure I need to rework it to move the object using the physics engine.
A couple of the obstacles I want to implement –
-ramps to jump with (require a certain speed to clear the gap)
-moving platforms the object can stop on, move with, and then continue off of.
So what kind of setup would you guys recommend? Do I use addForce or use rigidbody.moveposition (I’ve never used moveposition so I don’t know how it behaves)? I still want it to basically stick exactly to the waypoints drawn by the player (which uses a grid system), but I need it to observe gravity (so ignore that axis when reading waypoints) and be able to stay on moving platforms. Any help is greatly appreciated!
So here’s my current idea – I’ll be trying it later tonight if I don’t come up with a better one. Think it’ll work?
Move object with addrelativeforce (rigidbody.moveposition doesn’t seem viable for movement). when advancing to next waypoint: save current velocity, stop object, rotate object, apply saved velocity (but in new direction). Should that work for turning corners and maintaining speed (like you’re going north at 50mph and then suddenly you’re going east but still at 50mph)?