0

The question I asked probably isn't very clear, so I'll explain. If I have an x and y velocity, where the y goes towards the bottom of the screen, and the x goes towards the right of the screen, how would I convert the x and y velocity so that the y goes from the point to the particle at hand, and the x goes at a 90 degree angle from the y? If that explanation wasn't clear, then the reason I need to do this is so that I can minus a velocity as a particle tries to go away from a gravity source, but that source isn't just at the bottom of the screen.

What I have:

What I have

What I want:

What I want

Examples would be appreciated

  • This question is probably better asked in Maths, as its hard to see the programming aspect in how the question is worded. – Michael Shaw Mar 7 '15 at 20:19
  • I'm quite confused about this question, and I'm not sure what the mathematical and physical problems you're asking about precisely is. For example, velocity is invariant under translation (velocity is a vector, which is just a direction and a size; it's not coupled to a specific location). Gravitational acceleration diminishes with the inverse square of the distance, and modelling proper gravitational atraction is pretty trivial once you know the formula. Your image indicates you want to switch the coordinate system, but that's unnecessary – why precisely would you want to do that? – amon Mar 7 '15 at 23:33
  • @amon This could all be me overthinking my problem, but I just need an example of where you decrease the velocity of an object, because it is moving away from a source of gravity. I'm not sure if I'm correct, but I think you only decrease the velocity going away from the source of gravity, which is why I intended to switch coordinate systems, so you only decrease the velocity going away, not the (in the question example) x velocity. – Orfby Mar 8 '15 at 8:35
0

This is simpler than you think. Suppose you have a particle at position P with velocity V, and there is a gravitational attractor at G. The acceleration will act in the direction (G - P), call it A. Of course P, G, V, and A are all two-dimensional quantities.

You have to update position and velocity with each increment of time dt. You already know the new position is P + V dt. The new velocity will be V + A dt. There is no need to transform any vectors. You just have to calculate A = k(G - P).

  • I already know how to make the objects fall towards G, the problem is decreasing the velocity when P moves away from G, unless I'm over thinking the problem – Orfby Mar 7 '15 at 20:23
  • 1
    you are over-thinking the problem. There are only two equations to apply: P' = P + V dt and V' = V + A dt. When P is moving away from G then its speed will decrease. – kevin cline Mar 8 '15 at 2:47

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.