More improved/smoother way to make actor follow a path at a constant given speed?

Hello all,

I am attempting to make an actor/s follow a path, that is not straight, its angled before going into a circle, and then heading a different way.
I have looked a KevinCross demo on a winding path, however i can't get it to run smoothly, additionally the actor has to rotate to face the direction its facing. As well, it has to be able to be stopped and go at any given time.

What i have done, is use a table, placed in the x, y and rotation positions and has told the actor to move to each position after 0.5 second. However, this makes the actor go stop, go stop, because i havent been able to position the way points exactly the same distance from each other the whole time, the actor will take longer or quicker to reach the point. hence the delay.

I was hoping there was a smoother more better way of trying to get the same result. Or any ideas.

Think of a tower defence game were there is a tank following a path, however it just keeps moving, no delay no nothing. But it can be stopped on it tracks and still be able to take off again and continue on the path like it was before.
Possible?

Comments

  • BenMakesGamesBenMakesGames Member Posts: 85
    I can give you some insight as to how this was acheived with the flight control template I created.

    To stop the pauses(stopping before moving again) I had the actor determine the distance between the actor and a certain location. If the location was less than (x) then it would start moving to the next node.

    Check out this image, it may help you understand better.

    http://cdn.tutsplus.com/gamedev/uploads/2013/06/path_different_radius.png

    To constrain the distance between the points. You will need to set up the distance between coordinates.

    Im at work at the moment but I could delve into this later tonight.
  • Tiny_IdeasTiny_Ideas Member Posts: 326
    @BenMakesGames its a start, thanks.
    That might work in this case, will have to try it out. However not sure which function to use, magnitude? To calculate the distance? I am sure a quick google search will tell me.

    Just went to try flight control, the game, and its similar to what I need, but without the drawing the line feature. Fun game.

Sign In or Register to comment.