开发者

Getting Behind the target

This is more of a geometry question but I can't comeup with a proper way to do the following,

  • A is my agent
  • X is the player

I am trying to calculate a point w1 that I will be using as a way point to get to w2 which is my agents goal.


                                                         -|
                                                          |
      w2        X                   A                     |
                                                          |
                                                         -|
                w1

I am trying to avoid graph search as I only开发者_如何学JAVA need a single waypoint around the target and come up with a geometric relation any thoughts? any circle line intersection property that I am missing.

EDIT: constraints for the w1 is that it should be at a distance x and axw1 angle be 90 degrees. both a and x is circular objects.


You ask for a geometric relation describing the position of w1. Assuming A, W, and w2 are aligned and w1 is at distance d from X at a right angles from line AX, this is the system of two equations to solve for w1:

Getting Behind the target

i.e. segment w1-X is perpendicular to segment X-A

Getting Behind the target

i.e. distance between w1 and X is equal to d.

The above is in vectorial form. The same set of two equations can be expressed in scalar form:

Getting Behind the target

Getting Behind the target

Two equations to solve for two unknowns (x_w1 and y_w1) using high school algebra.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜