4
\$\begingroup\$

Given two Particles A and B which forms the arrow itself, A.P an edge of it and the opposite one B.P. Like so A.P---------B.P.

const float DistArrow = 60;

Where I have structure Particle:

struct Particle
{
    struct Complex P; //Position
    struct Complex F; //Gravitational Force
    struct Complex V; //Velocity
    float m; //Mass
}

At the start each particle, A and B has a starting Velocity of like (40, 70). And I am adding a value of force to A.F(0, -9.21) and B.F(0, -9.81). So that the B.F has much more weight on it, so it drags the A to down kind of.

I want the arrow to move like this:

The movement of the arrow

And I am tried to figure out how to make till I was stuck with this(I am trying to calibrate in a way the arrow to the initial DistArrow:

I am calibrating the arrow

A = erA->B*(D(AB)-DistArrow)/2+A; where erA->B(unit vector) = (B-A)D(AB);
B = erB->A*(D(AB)-DistArrow)/2+A; where erB->A(unit vector) = (A-B)D(AB);

The problem is that it just rotates 180 degree, dunno why it does, if it will infinitely fall it should be A at the top of B, a line perpendicular with oX.

I am seeking a good solution not involving to much physics, any advice will be highly appreciated.

\$\endgroup\$
  • \$\begingroup\$ You should probably mention what language and/or graphics library/engine you're using. And you should have more descriptive identifiers for your variables, instead of having just the first letter and writing the rest in a comment. \$\endgroup\$ – l'- Dec 17 '16 at 15:43
  • \$\begingroup\$ I am using C++. \$\endgroup\$ – DomainFlag Dec 17 '16 at 15:46
  • \$\begingroup\$ Arrows fly in the line they do because of the feathers at the tail. These cause a drag that is least when the arrow is pointing in the direction of movement. If there is a force that tries to rotate the arrow way this the feathers will push the arrow back. Rather than simulate the whole shebang, Use one point and just calculate the direction of motion and set the arrows direction to that. \$\endgroup\$ – Blindman67 Dec 17 '16 at 16:52
  • \$\begingroup\$ damn, i complicated myself only, the solution in the end is what I need. Didn't think about that. Thank you very much! :) \$\endgroup\$ – DomainFlag Dec 17 '16 at 17:01
5
\$\begingroup\$

You need a bit of physics, and a touch of calculus.

Lets assign P as the point of the arrow, L as the length of the arrow, and Q as the tail of the arrow.

You launch the arrow at an initial velocity of V, and a launch angle of A, and have gravity G as -9.81.

Vx = cos(A)*V
Vy = sin(A)*V

I is the intitial x and y locations of P at the moment the arrow was launched.

t represents the time in seconds since the arrow was launched.

function(t) {
  Px = t*Vx+Ix
  Py = G*t^2+Vy*t+Iy
  Sa = atan((2*G*t+Vy)/Vx)+pi
  Qx = Px+cos(Sa)*L
  Qy = Py+sin(Sa)*L
}
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ this is even better that what I could think for, thank you very much :) \$\endgroup\$ – DomainFlag Dec 17 '16 at 20:17

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.