Advertisement Jump to content


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


Radians and Vectors

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

Hi All, I was hoping to get a little clarification on this ... I just recently started game programming after several years of application programming. Needless to say, some of the concepts have been rather different than any appdev I've done. My question is this ... When would you use Radians over Vectors and vice versa. For more clarification, I often see questions in the forum asking about reflection angles. Most of the time, the answers are in the form of some sort of vector math. However, i recently created a test app that demonstrates reflection angles, but I used radians ... so all my "ship" object had to keep was a velocity, and a degree to plot it's direction. I found that thinking in terms of angles was very easy, and the math for reflection angles was very simple (I'm quite proud to say that I figured out that math on my own ;-) ). So I ask, what's so good about Vectors ... I must be missing something, but everything I've seen, I haven't quite been able to grasp. [edit]Just another small clarification, this is purely 2d stuff ... I haven't even wandered into 3d land yet ;-)[/edit] Thanks in advance for your answers Joel Martinez [edited by - joelmartinez on February 7, 2003 11:55:50 AM]

Share this post

Link to post
Share on other sites
Um, you would never use radians over vectors. They are two completely different things. Radians are one form of measure for angles, and vectors are mathematical constructs that contain both magnitude and direction (i.e., the angle is a part of the vector). Usually in physics, the angles are measured in degrees rather than radians, but there''s really no reason to do it this way, as either way is just as good.

Now, as for reflection angles, you don''t really need vectors at all, if you''re talking about elastic collisions, anyway, since the angle of reflection is the same as the angle with which an object hits a wall (or whatever).

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
The thing is, you ARE working with vectors, only using polar coordinates. So your question should be when to use polar over cartesian coordinates and vice versa. A simple example when cartesian coordinates is easier is adding vectors. How do you represent the position of your objects? How do you update their positions? My guess is you already use cartesian coordinates for this...

Share this post

Link to post
Share on other sites
Thanks for your response (both of you) ... to answer your questions

-How do you represent the position of your objects?
this.Direction (angle)

-How do you update their positions?
double radian = Math.Sin(Math.Pi * this.Direction) / 180;
double nX = this.Velocity * radian;
double nY = -(this.Velocity * radian)

this.X += (int)nX;
this.Y += (int)nY;

And I figure out the reflection angle like so:
double rAngle = (wallangle - player1.Direction) + wallangle;

//keep the angle within bounds
if (rAngle <= 1)
rAngle += 360;

if (rAngle > 360)
rAngle -= 360;

player1.Direction = rAngle;

So in what situation would a "Vector" become handy as I haven''t come across one yet (that''s not saying much though as I''ve only been game programming for about a month).


Joel Martinez

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!