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
:
The above is in vectorial form. The same set of two equations can be expressed in scalar form:
Two equations to solve for two unknowns (x_w1 and y_w1) using high school algebra.
精彩评论