Path following - like on rails
Posted: Wed Dec 09, 2015 6:53 pm
HI all,
I'm new here and new in game development. I'm looking for a way to make shapes (objects) follow a curved path and turn at the same time.
To make it more simple, I have a square grid with defined nodes. I already implemented the code that makes the object follow waypoints but they cannot turn while moving - the object reaches the node, stops, turns on the spot to to the next waypoint and starts moving again.
I tried to change the offset of the ocject and play with the coordinates to make a fake pivot for the turn and it works. The main problem is that it seems to be dependent on the initial conditions.
Example: the object is facing north and then all the right turns work, but when I start the scenario with the object facing say east then the turns are all messed up (it will still turn right but during the turn it will be "teleported" to another position)
Any advice or any alternative method/solution to make an object turn "like on rails"
Thanks!
I'm new here and new in game development. I'm looking for a way to make shapes (objects) follow a curved path and turn at the same time.
To make it more simple, I have a square grid with defined nodes. I already implemented the code that makes the object follow waypoints but they cannot turn while moving - the object reaches the node, stops, turns on the spot to to the next waypoint and starts moving again.
I tried to change the offset of the ocject and play with the coordinates to make a fake pivot for the turn and it works. The main problem is that it seems to be dependent on the initial conditions.
Example: the object is facing north and then all the right turns work, but when I start the scenario with the object facing say east then the turns are all messed up (it will still turn right but during the turn it will be "teleported" to another position)
Any advice or any alternative method/solution to make an object turn "like on rails"
Thanks!