Right now my problem is getting the camera to focus on a vector (currently 0,0,0), and rotate within constraints. The camera's yaw bugs out when it goes beyond +/-180 and automatically goes to the side of the constraint that is within the +/-180. I also lose control over pitch when I call fixangle=1.
Code: Select all
self.movetype = MOVETYPE_FLY;
self.torigin = '0 0 0'; // what to focus towards
self.tvec = vectoangles(self.origin-self.torigin);
self.ty = self.tvec_y - 180;
// need to be within +/- 180
if (self.ty < -180)
self.ty + 360;
if (self.ty > 180)
self.ty - 360;
// yaw constraints
if (self.angles_y > self.ty + 80)
self.angles_y = self.ty + 80;
if (self.angles_y < self.ty - 80)
self.angles_y = self.ty - 80;
// need to be within +/- 180
if (self.angles_y > 180)
self.angles_y - 360;
if (self.angles_y < -180)
self.angles_y + 360;
// pitch constraint
if (self.angles_x > 0)
self.angles_x = 0;
// debug output (heh, right)
sprint(self,ftos(self.tvecy));
sprint(self,"\n");
sprint(self,ftos(self.anglesy));
sprint(self,"\n");
self.fixangle=1;
I'm also trying to determine the best way of moving the camera in a circle around the given vector since the camera is being used for aiming the armaments.