P/S: The engine I work on doesn't have grouping integration. That's why I need a formula to change the position.


A and C are moving points that can move anywhere

A = (xa, ya), C = (xc, yc)

B (xb, yb) is a point between A and C colinearly

With one condition that distance of AB = constant = r, distance of AC can be varied.

How to find xb and yb?

Asked from Mathematics StackExchange:

Deepak says:

The locus of all possible points B is a circle centred on A and of radius r. The intersection between this circle and line AC will give you point B (and another point opposite it on the circle which you can neglect).

Try to write down the relevant equations and solve them?

Example: http://www.mathopenref.com/collinear.html

  1. Calculate AC (xC - xA, yC - yA)
  2. Normalize it
  3. Multiply it by r
  4. Add that vector to A : done !
|improve this answer|||||
  • \$\begingroup\$ AC means the vector? Not sure how you calculate the AC. \$\endgroup\$ – Fatty Mieo Jun 27 '16 at 9:49
  • 1
    \$\begingroup\$ @FattyMieo yes, that's the vector from A to C. You just have to subtract their coordinates as I wrote there. I suggest you take a bit of time to learn the basics of vector calculus, it helps a lot. \$\endgroup\$ – Quentin Jun 27 '16 at 9:53
  • \$\begingroup\$ Actually using Stencyl (for my homework requirement), the only thing can be changed is velocity, rotation(by one end of the object or center), and position. Have to research deep in vector but I don't have much time to invest. \$\endgroup\$ – Fatty Mieo Jun 27 '16 at 10:09
  • \$\begingroup\$ @FattyMieo that's fine, just perform the calculations and update B's position once you're done. Or can Stencyl not do math operations ? \$\endgroup\$ – Quentin Jun 27 '16 at 10:15
  • \$\begingroup\$ Can you do a workout for me, please? Struggled to read vectors. Really need it urgent as it's going to pass up soon. There is no vector operation available in Stencyl :( \$\endgroup\$ – Fatty Mieo Jun 27 '16 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.