# Limiting rotation between 90 and 0 degrees [Solved]

Hi,

In order to learn my way around jME I'm currently writing a simple chess game. I use the mouse to select and move pieces and the keyboard to move the camera. The camera is attached to a camNode which is attached at a distance of 100y to a Node at the center of the board and facing in the -y direction.

To have the camera rotate around my scene (which has the board in the middle) I rotate this last Node around the y axis on Left/Right and another axis in the x/z plane on Up/Down. [Edit: Now I'm thinking about it I'm not quite sure that this second axis even stays in the x/z plane, if so, it would be easier]

Because I don't want the player to move the camera below the board (below the x/z plane actually) or across the center of the board I want to limit the rotation in relation to this x/z axis to a maximum of 90 and a minimum of 0 degrees.

As you have probably guessed by now I'm not quite up to figuring out the math for this, so I was wondering if there's a good way of doing this.

Horizon

[Edit: I'm gonna try and see if splitting my center Node up into one each for up/down and left/right rotation will make things easier.]

[Edit: Why is it always when explaining something like this to somebody else that the solution suddenly comes to you? I had already tried to explain the problem to one of my roommates, but apparently posting this triggered something. I solved it by splitting that Node in two after all. Thanks anyway.]

i have made turns by 90

Thanks, but that's not what I was looking for. I wanted to turn continuously but to a maximum of 90 and a minimum of 0 degrees. I've solved it already, but thanks anyway.

so how did you solve this ?

sorry  ignore the post above…

damn…should really read it more thoroughly…