-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolves Issue#5958 3D orbitControl allowing +-90 degrees not enough. #6012
Conversation
@davepagurek Kindly review this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this change, it feels great when playing around with it! The code works great, so my only minor suggestions are about code style/comments 🙂
src/webgl/p5.Camera.js
Outdated
camPhi += dPhi; | ||
camRadius += dRadius; | ||
// add change according to the direction of this.upY | ||
let directionflag = this.upY > 0 ? 1 : -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can name this variable newUpY
since that's what it will end up getting used for?
And then the comment about changing according to the direction of this.upY
would maybe then be better placed at the if statement where we flip it, with a small explanation of why we have to flip it (something about orbiting to the other side and now being upside-down.)
src/webgl/p5.Camera.js
Outdated
let directionflag = this.upY > 0 ? 1 : -1; | ||
camTheta += directionflag*dTheta; | ||
camPhi += directionflag*dPhi; | ||
if (camPhi <= 0 || camPhi>=Math.PI) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super minor, but on this line and the ones above, can we add spaces around the operators so they match the style of the rest of the file?
@davepagurek I made all the changes. Kindly review it now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, great work!
Thanks, wouldn't have been possible without your tips :) |
Resolves #5958
Changes:
camPhi
was bound in the range[0,pi]
andupY
was only1
,directionflag
is added to change the direction ofupY
of thecamera
object,camPhi
gets increment with respect to the direction ofupY
camPhi
can rotate 360 deg and continue rotating in any direction,camTheta
is modified by multiplying the sign ofdirectionflag
to the increment/decrementdirectionflag
used to determine theupY
property of thecamera
objectcamPhi
resulted in a need of new testsPR Checklist
npm test
npm run build
passesnpm run lint
passes