Angle of Trajectory?
I'm trying to create a bullet class that stores the bullets current position (x,y,z) and its trajectory. Traditionally I've used 3 variables called xtraject, ytraject, and ztraject where each loop xtraject was added to x and same for y/z. So in order to get the bullet travelling upper right at a 45 degree angle xtraject and ytraject would be 1. I'm want to have bullets that can fire at arbitrary angles, perhaps just have an angle variable (maybe I would need 2?) to control which way it goes and then a speed to say how fast its moving.
Do I use polar coordinates to do this? What about quaternions?
You really need to learn how to use the search button, buddy.
Although that post is really not about the same thing. There is another post here about bullets that covers it better.
This is only for 2D, for 3D you must do a little more.
#define PI 3.14159
#define DEGTORAD(angle) ((double)angle*PI/180.0)
void FireBullet(point2D Start,int angle,double speed,Bullet *newbullet)
//Assuming we have an array of Bullet objects called Bullets
for (int i=0;i<NumBullets;i++)