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

Limit Yaw, Pitch or Roll Rotation to a set angle

Open carlosnavarro-cn opened this issue 3 years ago • 4 comments

Hello James, 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 infinite times). Is there a way to limit the pitch rotation to 180 degrees, as it happens on any of the models in this website here: https://app.shapediver.com/m/array-table-dimension

Thanks in advance, CN

carlosnavarro-cn avatar Jul 12 '20 02:07 carlosnavarro-cn

This type of angle limitation does not presently exist in EasyCam (or its predecessor) and would be considered a feature request. I'll leave this issue open if someone wishes to contribute this enhancement. For an existing p5.js camera solution, similar to what you shared, see SimpleCam. Check out the examples on that repository page.

jwdunn1 avatar Jul 13 '20 03:07 jwdunn1

This type of angle limitation does not presently exist in EasyCam (or its predecessor) and would be considered a feature request. I'll leave this issue open if someone wishes to contribute this enhancement. For an existing p5.js camera solution, similar to what you shared, see SimpleCam. Check out the examples on that repository page.

James, thanks for your feedback. I just looked into the SimpleCam repository and think it works more similarly to what i was intending. With regards to this subject on EasyCam, I was also trying to set the 3 (yaw, pitch and roll) constrain rotation parameters all to false for when I wanted to stop all rotations completely, but I see that 3 falses end up resulting as if they were all set to true. Is they a way to stop all rotations, and also stop the zomming completely to have as if it were a still camera? I looked into set rotation, and the mouse and wheel controls but didn't get to anything. Thank you.

carlosnavarro-cn avatar Jul 13 '20 03:07 carlosnavarro-cn

An EasyCam instance can be deactivated by removing the event listeners. A simple example using keys as toggles:

function keyPressed(){
  if(key=='r') cam.removeMouseListeners();
  if(key=='a') cam.attachMouseListeners();
}

jwdunn1 avatar Jul 13 '20 08:07 jwdunn1

An EasyCam instance can be deactivated by removing the event listeners. A simple example using keys as toggles:

function keyPressed(){
  if(key=='r') cam.removeMouseListeners();
  if(key=='a') cam.attachMouseListeners();
}

This works great. Thank you!

carlosnavarro-cn avatar Jul 13 '20 08:07 carlosnavarro-cn