Point following

  • Renato

    Renato - 2007-04-15

    I have a path planner algorithm and I want to use Replicant Body to show the results.
    The path planner's output are points in the space, relative to the next position of the character.
    The integration of  the path planner with the Replicant Body works OK.
    I create my own osgBodyCallback, and implement some method to let the characters following points.
    To move the character (walk animation) or turn (turn animation) I have to specify the velocity.

    My idea was:

    1 - Run the "walk animation". (Velocity = 1)
    2 - Calculate the distance of the character to the goal point.
    3 - Calculate the time ( T = distance / Velocity )  that the character will spend to reach the goal (in a straight line).
    4 - Calculate the rotation angle (THETA) to allign the character's orientation with the goal point direction.
    5 - Run the "turn animation" (The velocity here will be THETA / T).

    Every time that the callback is called, the steps 2 - 5 are done. The calculation is based on a straight line trajectory, but the character walks a curve. This aproximation works fine due to the recalculation of the directions.
    Every time a reached a goal point, there will be a next goal point.
    With this idea, the character not necessary pass through the points (its a aproximation), but it works OK.

    I implemented it based on "Walk animation" and "Turn animation". I think I'm not doing the right thing.

    Is there a better way to do it, I have to do it in every character callback (myOsgBodyCallback)?
    Is there a point following already implemented?

    Any thoughts would be greatly appreciated.

    Thank you in advance.

    • Renato

      Renato - 2007-07-31

      I saw the Delta3D class "FollowController", and it helps me a lot.

      Thank you.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks