Jump to content


Photo

start on path from any close position


  • Please log in to reply
5 replies to this topic

#1 creators124

creators124

    awesomeliciousmember

  • GMC Member
  • 866 posts
  • Version:GM8

Posted 03 June 2012 - 08:26 AM

just like the title I need help with an object starting a path from the closest path position.
I have no code for this. Posted Image
I already googled it, too! Posted Image

Edited by creators124, 03 June 2012 - 08:27 AM.

  • 0

#2 NukeTheCat

NukeTheCat

    GMC Member

  • GMC Member
  • 470 posts
  • Version:GM8.1

Posted 03 June 2012 - 10:32 AM

Here is a guess but I don't know whether it will work:
path[1,0] = path_get_x(path1,0);
path[1,1] = path_get_y(path1,0);
//path one
path[2,0] = path_get_x(path2,0);
path[2,1] = path_get_y(path2,0);
//path two
if distance_to_point(path[1,0],path[1,1]) < distance_to_point(path[2,0],path[2,1])
{
path_start(path1,speed,0,1)
}
else
{
if distance_to_point(path[1,0],path[1,1]) > distance_to_point(path[2,0],path[2,1])
{
path_start(path2,speed,0,1)
}
}
/*this checks whether the distance to the x and y coord of path1 
is smaller than the distance of the other*/
//I think it might work but I don't really know how to make it above 2 paths

  • 0

#3 creators124

creators124

    awesomeliciousmember

  • GMC Member
  • 866 posts
  • Version:GM8

Posted 03 June 2012 - 10:57 AM

Here is a guess but I don't know whether it will work:

path[1,0] = path_get_x(path1,0);
path[1,1] = path_get_y(path1,0);
//path one
path[2,0] = path_get_x(path2,0);
path[2,1] = path_get_y(path2,0);
//path two
if distance_to_point(path[1,0],path[1,1]) < distance_to_point(path[2,0],path[2,1])
{
path_start(path1,speed,0,1)
}
else
{
if distance_to_point(path[1,0],path[1,1]) > distance_to_point(path[2,0],path[2,1])
{
path_start(path2,speed,0,1)
}
}
/*this checks whether the distance to the x and y coord of path1 
is smaller than the distance of the other*/
//I think it might work but I don't really know how to make it above 2 paths

THANKS! Posted Image
but I really don't want to start the path from the start of it! Posted Image
  • 0

#4 NukeTheCat

NukeTheCat

    GMC Member

  • GMC Member
  • 470 posts
  • Version:GM8.1

Posted 03 June 2012 - 07:00 PM

Oh, then where do you want to start it at?
  • 0

#5 creators124

creators124

    awesomeliciousmember

  • GMC Member
  • 866 posts
  • Version:GM8

Posted 03 June 2012 - 07:03 PM

Oh, then where do you want to start it at?

at the closest point of the path possible!
so it won't just jump from onside to the other. Posted Image
  • 0

#6 NukeTheCat

NukeTheCat

    GMC Member

  • GMC Member
  • 470 posts
  • Version:GM8.1

Posted 03 June 2012 - 07:03 PM

Then maybe this:
path_start(path,0,0,1);
path_position = ??
//haven't come up with an equation yet
//but with path_position you can skip

Edited by Jlm07, 03 June 2012 - 07:15 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users