#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# PeasyCam rotation constraint question

edited June 2014

Hello !

Pretty new to Processing here, I'm trying to get my PeasyCam a rotation without losing my first constraints.

Right now i have this on my void draw

rotateZ(45); rotateX(45);

and all of my cam stuff in another tab

void cam(){

cam = new PeasyCam(this, 0, 0, 0, 800);

cam.setMinimumDistance(500);

cam.setMaximumDistance(5000);

}

Here what I search in green, and in red the actual rotation constraint (freelook). Basically I'm looking for a rotation INCLUDING my rotateZ and X.

Here is what the cam give me when i move my mouse

Here is the kind of thing i want when i move my mouse.

Could you write me down a solution for this problem ? I checked the peasycam example and site, nothing.

Tagged:

• please someone ? I really need it and my deadline are coming closer :)

• i think we need a running example for this. i don't understand your diagrams (i realise it's hard to draw 3d rotation on 2d screen)

what i think you're getting at is that you always want the oblique view of the room, looking down on it as in last diagram, but you want the rotation to rotate the room

maybe you want to constrain the height of the camera, so it's rotating in a circle at a height above the room, looking down into it. not sure how you do this with peasycam.

• try using prespective() https://www.processing.org/reference/perspective_.html I dont would it help you or not :/

• it won't. perspective() doesn't affect camera position, just the view frustum.

camera() might work. the 'center' arguments would be a point in the centre of the top of the object, the 'eye' constrained to a circle (based on mousepos) on a plane a bit above, and the 'up' vector would be constant. you lose a lot of peasycam's useful stuff but it sounds like you want to disable that anyway.

but post some code.

• Thank you both for your respons; Koogs what you write is exactly what I'm looking for.

I've uploaded two quick video of what I have and what I'm looking.

What I want is just a oblique view of the room AND the possibility to turn around. You can see in the video I already can do that, but it take practice and softness with the mouse.

• edited June 2014
``````// By default, the camera is in "free rotation" mode, but you can
// constrain it to any axis, around the look-at point:
camera.setYawRotationMode();   // like spinning a globe
camera.setPitchRotationMode(); // like a somersault
camera.setRollRotationMode();  // like a radio knob
camera.setSuppressRollRotationMode();  // Permit pitch/yaw only.
``````

Yaw might be the one you want. unfortunately, my version of peasycam doesn't support it...

• I already tryed this, every single one and mixed, and no one give me a proper resultat. Right now I'm trying to displace the moment where my cam get an oblique view, to see if it change something. Basically; rotationX before cam or reverse...