Limiting rotation so that camera only controls 1 direction of rotation

Create a new class with a Camera. In your class create a new enum Axis {AxisX, AxisY, AxisZ} create a variable like Axis axis; and in your analog listener make a condition if(axis == Axis.AxisX) rotate the camera ect…



[java]



if(name.equals("Cam_Left"){



Quaternion tempQuat = new Quaternion();

float angle[] = {0,0,0};

cam.getRotation().toAngles(angle);

switch(axis){



case AxisX:{



angle[0] += value;



}

case AxisY:{



angle[1] += value;



}

case AxisZ:{



angle[2] += value;



}



}

cam.setRotation(tempQuat.fromAngles(angle));



}



[/java]