algorithm - Unity Line Vector Calculation -


let's suppose have 2 position vectors a , b, base line:

g: x = + r*d (d being direction of line)

can sure b lies on g due game generation algorithm. question how can find r?

problem seems result being positive, when calculating length , checking how d fits result positive, , therefore partly correct.

other idea calculate a + r * d = b <=> r = (b - a) / d . unity doesn't allow vector division.

thank in advance help, maybe being stupid @ point. sorry

g result, start point.

  r = (g -a ).magnitude; 

use dot(d, (g-a)) know whether positive or negative.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -