Results 1 to 3 of 3

Math Help - Trying to write a pathfinding program for a game.. have X,Y,Z and heading.

  1. #1
    Newbie
    Joined
    Apr 2010
    Posts
    3

    Trying to write a pathfinding program for a game.. have X,Y,Z and heading.

    Im finding it quite difficult to write a routine that takes coordinates from a game, puts them into an array then retraces back over them. Actaully the only hard part is getting the script to "face" the direction I want it to go. Its a 3 dimentional game in a 3rd person view. Im reading packets and only have the heading of which im facing, x coord, y coord and z coord. I know that if I can save coord X and Y walk away and do some trig I can make my heading point directly back to the X and Y that I saved (but I dont know the trig :/ )

    Plz help!
    Last edited by Diminished; April 28th 2010 at 09:48 AM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Apr 2010
    Posts
    3
    Basically Im trying find a way to calculate the direction I need to face from having the first coord to the next coord in a 360 degree view.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Apr 2010
    Posts
    3
    Just in case anyone was wondering, I figured it out... you have to take X1 - X2 and Y1 - Y2 then take those results (X3 , Y3) and divide X3 by Y3 or Y3 by X3 (depending on which one is greater) then Divide 180 by PI and the direction Im looking for is ArcTan of X3 / Y3 * ( 180 / PI )

    direction = atan((y3/x3) * (180/3.1415))
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Finding a plane's heading and length of trip
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: May 25th 2010, 04:54 PM
  2. Replies: 6
    Last Post: December 21st 2009, 05:54 PM
  3. Fixing The Program (Program Correctness)
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: March 21st 2009, 02:17 PM
  4. Sequential-form game (game tree diagram)
    Posted in the Advanced Statistics Forum
    Replies: 0
    Last Post: October 5th 2008, 06:51 PM
  5. program to write...
    Posted in the Math Forum
    Replies: 8
    Last Post: August 9th 2006, 06:01 AM

Search Tags


/mathhelpforum @mathhelpforum