Jump to content
  • Advertisement
Sign in to follow this  
NextEpisode1

2D vector phisics problem (repost)

This topic is 3080 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

In my first post i gues i wasn't clear enough,since people told me about arrays , lists and operator overloading.

To be specific: I am not talking about data collections of any sort. Im talking about 2 dimensions geometrical vector that describes the trajectory and speed of an object.

Can any1 tell me a book related to it,or to post an example of some sort that can perform a simple geometrical vector operation.I dont know how to represent the actual vector in a system where point is described by (x,y).

Share this post


Link to post
Share on other sites
Advertisement
I'd start with the basics here. (For now, you can probably skip the parts on matrices and instead concentrate on vector, but matrices are very helpful in games.) The actual representation of a 2D vector in code can be as simple as having two variables; an x and a y. For non-trivial programs, you'll want to wrap the concept of a Vector into a structure, class, or something like that. For example, in C++ you might have:
struct Vector {
float x;
float y;
};

Then you might make operators or functions which act on the Vector to apply geometric operation.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ezbez
I'd start with the basics here. (For now, you can probably skip the parts on matrices and instead concentrate on vector, but matrices are very helpful in games.) The actual representation of a 2D vector in code can be as simple as having two variables; an x and a y. For non-trivial programs, you'll want to wrap the concept of a Vector into a structure, class, or something like that. For example, in C++ you might have:
struct Vector {
float x;
float y;
};

Then you might make operators or functions which act on the Vector to apply geometric operation.


There is hope for human kind :P, thanks vm dude , thats exactly what i wanted.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!