Resolves Issue#5958 3D orbitControl allowing +-90 degrees not enough.#6012
Resolves Issue#5958 3D orbitControl allowing +-90 degrees not enough.#6012davepagurek merged 5 commits intoprocessing:mainfrom
Conversation
|
@davepagurek Kindly review this. |
davepagurek
left a comment
There was a problem hiding this comment.
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.
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.
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. |
davepagurek
left a comment
There was a problem hiding this comment.
Looks good, great work!
Thanks, wouldn't have been possible without your tips :) |
Resolves #5958
Changes:
camPhiwas bound in the range[0,pi]andupYwas only1,directionflagis added to change the direction ofupYof thecameraobject,camPhigets increment with respect to the direction ofupYcamPhican rotate 360 deg and continue rotating in any direction,camThetais modified by multiplying the sign ofdirectionflagto the increment/decrementdirectionflagused to determine theupYproperty of thecameraobjectcamPhiresulted in a need of new testsPR Checklist
npm testnpm run buildpassesnpm run lintpasses