CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Threaded View

  1. #4
    Join Date
    Feb 2012
    Posts
    23

    Re: Still Some Trouble Creating Gravity

    I'm glad it's Peter_B here to save the day yet again.

    As for the complicated switch.. I know it's horrible x.x
    I was really trying to get things working correctly before going to clean up (for some reason--making it hard on myself).

    I planned on creating classes and doing simply class.mass()
    But I might do a quick implementation of a function call to simplify things for me for now!

    As for the next part, I'm not sure how to multiply the G*M1*M2/R^2 by vector V.
    I did a quick Google to find that normalizing is simply dividing each of the components by the length--so dividing each one by r would do it I believe, or would it be dividing by tempForce?

    I think it would be r, as you said the distance from object 1 to object 2.

    But how would I go about multiplying by the vector? Sorry for the utter ignorance on the subject of vectors, but thanks so much for your help again!

    Also, did you mean to put the - in front of the equation G*M1*M2/R^2 * V ? It's meant to be negative?
    Last edited by Filthy_Utter; March 27th, 2012 at 06:51 PM. Reason: Forgot one thing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured