p5.EasyCam icon indicating copy to clipboard operation
p5.EasyCam copied to clipboard

Adjust camera movement

Open mcanepa opened this issue 6 years ago • 3 comments

First of all I must tell you that this is fantastic, congratulations for such a nice work.

I have an issue that I'm not sure if can be corrected via configurarion. This is the scenario:

See this demo and this one, On both examples drag the mouse following this pattern

patetrn

What you should see is that with three.js the object moves slowly following more accurate the mouse, whereas with EasyCam the object moves faster and rotating in other axis.

For example, if I move the mouse only horizontally, in three.js the object moves in that plane, but if I perform the same movement with EasyCam the object kind of start wobbling

mcanepa avatar Jan 24 '18 16:01 mcanepa

Hi,

The easycam-behaviour you describe is "camera-roll". An excentric drag becomes a rotation around the viewers axis == roll.

You can disable it, by limiting the rotations to yaw and pitch only.

easycam.setRotationConstraint(yaw, pitch, roll)

The first example is the default setting, yaw-pitch-roll, all enabled. easycam.setRotationConstraint(true, true, true); So, when your drag is very excentric the rotation happens only around the viewer axis (z-axis, when viewed from the top). The more you drag somewhere in the center area of the canvas, yaw and pitch gets effective. https://jsfiddle.net/wqjugp9m/9/

The second example is more like the three.js example, limited to yaw-pitch. easycam.setRotationConstraint(true, true, false); https://jsfiddle.net/wqjugp9m/10/

diwi avatar Jan 25 '18 03:01 diwi

I also wanted to say thanks for your work on the library.

I tried implementing the above to fix the issue, calling setRotationConstraint() in setup(), but it doesn't seem to have any effect. I also can't tell whether it works or not in the examples you posted above.

joquist avatar Apr 06 '20 20:04 joquist

Hello Diwi, I tried successfully your indications to limit the yaw, pitch and roll rotations. I would love to limit the angle for each of this. Right now they have a rotation similar to 360 (or they can rotate infinit times). Is there a way to limit the pitch rotation to 180 degrees, as it happens on this website here: https://app.shapediver.com/m/array-table-dimension

Thanks in advance, CN

carlosnavarro-cn avatar Jul 07 '20 05:07 carlosnavarro-cn