• Create Account

We need 1 more developer from Canada and 12 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a \$50 Amazon gift card. Click here to get started!

### #Actualmklingen

Posted 15 September 2013 - 04:24 PM

I have two solutions. Both of them rely on treating the path not as a path per-se but as a trajectory. What you want is for your agent to move such that at each point in time, the agent is close to the path, and his velocity is along the path. So, you've got to add another dimension to your path: time. You can turn your static path into a function that says "where should I be at time t?" the agent then tries to get to the point "where he should be". This is called a trajectory.

The easy solution:

• Take the entire trajectory as a single curve paramaterized by time t between 0 and 1. Create a function which goes from [0,1] to a 3D point f(t).
• The agent starts at t = 0. He seeks the point f(t) until he's within a radius (called the blend radius).
• t then advances by a small amount.

That's it!

The better solution:

• Start again with a trajectory paramaterized by a single number between 0 and 1.
• Find t_x such that the distance between the agent and the trajectory is minimized. (If you trajectory is piecewise linear, this involves projecting to the nearest line)
• Seek the point  f(t_x + e)  where e is a small number representing the "lookahead time". e can be larger the further away the agent is from the trajectory.

I also have source code and a graphical example for the second solution:

http://www.openprocessing.org/sketch/96006

### #4mklingen

Posted 15 September 2013 - 04:23 PM

I have two solutions. Both of them rely on treating the path not as a path per-se but as a trajectory. What you want is for your agent to move such that at each point in time, the agent is close to the path, and his velocity is along the path. So, you've got to add another dimension to your path: time. You can turn your static path into a function that says "where should I be at time t?" the agent then tries to get to the point "where he should be". This is called a trajectory.

The easy solution:

• Take the entire trajectory as a single curve paramaterized by time t between 0 and 1. Create a function which goes from [0,1] to a 3D point.
• The agent starts at t = 0. He seeks that point until he's within a radius (called the blend radius). t then advances by a small amount.

That's it!

The better solution:

• Start again with a trajectory paramaterized by a single number between 0 and 1.
• Find t such that the distance between the agent and the trajectory is minimized. (If you trajectory is piecewise linear, this involves projecting to the nearest line)
• Seek that t plus a lookahead term epsilon

I also have source code and a graphical example for the second solution:

http://www.openprocessing.org/sketch/96006

### #3mklingen

Posted 15 September 2013 - 04:22 PM

I have two solutions. Both of them rely on treating the path not as a path per-se but as a trajectory. What you want is for your agent to move such that at each point in time, the agent is close to the path, and his velocity is along the path. So, you've got to add another dimension to your path: time. You can turn your static path into a function that says "where should I be at time t?" the agent then tries to get to the point "where he should be".

The easy solution:

• Take the entire trajectory as a single curve paramaterized by time t between 0 and 1. Create a function which goes from [0,1] to a 3D point.
• The agent starts at t = 0. He seeks that point until he's within a radius (called the blend radius). t then advances by a small amount.

That's it!

The better solution:

• Start again with a trajectory paramaterized by a single number between 0 and 1.
• Find t such that the distance between the agent and the trajectory is minimized. (If you trajectory is piecewise linear, this involves projecting to the nearest line)
• Seek that t plus a lookahead term epsilon

I also have source code and a graphical example for the second solution:

http://www.openprocessing.org/sketch/96006

### #2mklingen

Posted 15 September 2013 - 02:39 PM

I have two solutions.

The easy solution:

• Take the entire trajectory as a single curve paramaterized by time t between 0 and 1. Create a function which goes from [0,1] to a 3D point.
• The agent starts at t = 0. He seeks that point until he's within a radius (called the blend radius). t then advances by a small amount.

That's it!

The better solution:

• Start again with a trajectory paramaterized by a single number between 0 and 1.
• Find t such that the distance between the agent and the trajectory is minimized. (If you trajectory is piecewise linear, this involves projecting to the nearest line)
• Seek that t plus a lookahead term epsilon

I also have source code and a graphical example for the second solution:

http://www.openprocessing.org/sketch/96006

### #1mklingen

Posted 15 September 2013 - 02:30 PM

I have two solutions.

The easy solution:

• Take the entire trajectory as a single curve paramaterized by time t between 0 and 1. Create a function which goes from [0,1] to a 3D point.
• The agent starts at t = 0. He seeks that point until he's within a radius (called the blend radius). t then advances by a small amount.

That's it!

The better solution:

• Start again with a trajectory paramaterized by a single number between 0 and 1.
• Find t such that the distance between the agent and the trajectory is minimized. (If you trajectory is piecewise linear, this involves projecting to the nearest line)
• Seek that t plus a lookahead term epsilon

PARTNERS