Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Vector math/physics question.

This topic is 6514 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m writing a gravitation demo for my physics class, and I''m not really having a "problem" but there''s something that I would like to do a better way, that I think can probably be made better. OK, during all my vector calculations, I''m keeping my vectors in components for ease of use. This is fine for calculating acceleration based on force, velocity based on acceleration, etc., but for calculating gravitational force based on distance and mass (Fgrav = (Gm1m2)/(d^2) ) calculating in components doesn''t work because distance is the vector quantity in the equation, and it''s squared instead of just multiplied. At least, that''s the only reason I can think of that it doesn''t work, but it turns out that that equation (I guess because of the square) only gives a total vector magnitude, and does not work out correctly when calculating in components. So currently I''m calculating the total magnitude and then separating it into x and y components to return it to my other functions in the hopes that I''ll be able to find a way to calculate it in components right off and can replace what I''m currently doing with that. Does anyone have any idea what I can do to get the force in components, despite the vector being squared in the equation? (Or was my situation clear enough?)

Share this post

Link to post
Share on other sites
Well I don''t know if I am right - I may be wrong - but this is how vector is done in physics - lol I may be totally off the question coz basically it went over my head.

Consider you have a force F - however you have calcuated it. Generally you would use F * (cos value) for horizontal component
and F * (sin value) for vertical component. This is how you get the component values. The total magnitude is given by sqrt(Horizontal Component^2 + Vertcial Component^2).

Hello from my world

Share this post

Link to post
Share on other sites
In vector based physics you rarely resort to sin''s & cos''s, its kinda an advantage of doing stuff with vectors.

Calculate the gravitational force
Create a vector from the center of one mass to the other
Normalize it
Mutliple by the grav. force
Voila, the force vector
Reverse the vector, apply to other mass

PS If you get the vector directions backwars you''ll create anti-grav

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!