   Bullet function approach()
  I have a bullet class. In that bullet class, there is an init method that looks like this:void init(double fromX, double fromY, double fromZ, double approachX, double approachY, double approachZ, double speed);Every time the player shoots, the bullet looks like this://view_angle is the horizontal angle that the player is looking (in radians)//sight is the verticle angle that the player is looksing (in radians)b.init(player1->getX() + cos(view_angle)*cos(sight)*200,player1->getY() + sin(sight), player1->getZ() + sin(view_angle)*cos(sight), cos(view_angle)*cos(sight)*500, sin(sight)*500, sin(view_angle)*cos(sight)*500, 1000);I have two questions. 1.  Are the parameters that I entered in the above init function correct?2.  In my main function, I want to call b.approach() which approaches whatever approachX approachY and approachZ were most recently set to. Whats the best way to write this function?Thanks for your help. If you see a better way to designe the Bullet class, please let me know.   
Quote:Original post by bballmitchvoid init(double fromX, double fromY, double fromZ, double approachX, double approachY, double approachZ, double speed);Every time the player shoots, the bullet looks like this://view_angle is the horizontal angle that the player is looking (in radians)//sight is the verticle angle that the player is looksing (in radians)b.init(player1->getX() + cos(view_angle)*cos(sight)*200,player1->getY() + sin(sight), player1->getZ() + sin(view_angle)*cos(sight), cos(view_angle)*cos(sight)*500, sin(sight)*500, sin(view_angle)*cos(sight)*500, 1000);I have two questions. 1.  Are the parameters that I entered in the above init function correct?2.  In my main function, I want to call b.approach() which approaches whatever approachX approachY and approachZ were most recently set to. Whats the best way to write this function?Thanks for your help. If you see a better way to designe the Bullet class, please let me know.The parameter names are a little confusing, but it looks like the first three arguments are the starting position of the bullet, and the next three are its direction of motion (if so, its name should be changed to reflect that). I'm not sure though why the direction is not unit length given that speed is stored separately.The spherical coordinate conversion looks correct, I think. And yes, there are probably better ways to set this up, but maybe you could first clarify what the 'appoach' variable does and why it's not unit length.   ;  Yeah, my weapon class are a little less complicated, like i have:****************//(y pointing up, up vector)//dir, is pan//tilt is the headingclass {vector posvector velvoid init(vector t_pos, float dir, float tilt,float speed) {pos=t_posvel.x=cos(dir)*cos(tilt)vel.z=sin(dir)*cos(tilt)vel.y=sin(tilt)vel*=speed}void step(float time){pos+=vel*time}}****************b.init(player.pos,player.dir,player.angle,200)*********But, yeah, i'm not sure what you mean by "approach"