This is my free roaming camera code..how do i implement it such that it is not able to move outside my room box and stays within the boundaries?
//this function updates camera object, which implements free roaming camera
void freeRoamCamera(void)
{
VECTOR vMove = {_VAR(0), _VAR(0), _VAR(0)};
VECTOR vForce = {_VAR(0), _VAR(0), _VAR(0)}; //temp variables for moving and rotating the camera
//update camera rotation variables based on mouse input, and multiply by mouse sensitivity
vForce.x = _VAR(-1*MOUSE_SENSITIVITY*_FLOAT(v(mouse_force).x)*FLOATV(time_frame)); //set pan angle variable
vForce.y = _VAR(MOUSE_SENSITIVITY*_FLOAT(v(mouse_force).y)*FLOATV(time_frame)); //set tilt angle variable
//set roll based on q and e keys
vForce.z = _VAR((FLOATV(key_e) - FLOATV(key_q))*FLOATV(time_frame)); //set roll angle variable
//update camera position variables based on keyboard input W,A,S,D,home,end keys
vMove.x = _VAR(CAMERA_SPEED*(FLOATV(key_w) - FLOATV(key_s))*FLOATV(time_frame)); //set forward variable
vMove.y = _VAR(CAMERA_SPEED*(FLOATV(key_a) - FLOATV(key_d))*FLOATV(time_frame)); //set sideways variable
vMove.z = _VAR(CAMERA_SPEED*(FLOATV(key_home) - FLOATV(key_end))*FLOATV(time_frame)); //set upward variable
//update the camera's rotation and position
vec_add((VECTOR*)&v(camera).pan, &vForce); //rotate camera based on vForce variable
vec_rotate(&vMove, (ANGLE*)&v(camera).pan); //rotate vMove variable in direction of camera
vec_add((VECTOR*)&v(camera).x, &vMove); //move camera position based on vMove variable
}