• ### What is your GameDev Story?

#### Archived

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

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

## Recommended Posts

##### 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 on other sites
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 on other sites
Hi,

-How do you represent the position of your objects?
this.X
this.Y
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 boundsif (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).

Thanks

Joel Martinez
http://www.codecube.net/

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 14
• 12
• 15
• 11
• 12
• ### Forum Statistics

• Total Topics
634153
• Total Posts
3015846
×