-
-
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
Implemented roll function #6819
Implemented roll function #6819
Conversation
Implemented roll function
Hey @davepagurek please review it. Thanks. |
I was taking a look at the example, and it seems like the implementation doesn't quite do what a roll actually is. Here, it seems to do something kind of like What I would expect it to do is produce something kind of like how It looks like that's because Lines 1052 to 1057 in 4c13650
I think the correct output of If that's true, then I think (but am not certain, definitely test this!) that we could edit const rotatedUp = [
this.upX * rotation.mat4[0] + this.upY * rotation.mat4[4] + this.upZ * rotation.mat4[8],
this.upX * rotation.mat4[1] + this.upY * rotation.mat4[5] + this.upZ * rotation.mat4[9],
this.upX * rotation.mat4[2] + this.upY * rotation.mat4[6] + this.upZ * rotation.mat4[10]
]; |
* createCanvas(100, 100, WEBGL); | ||
* normalMaterial(); | ||
* cam = createCamera(); | ||
* // set initial pan angle |
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.
There are a few uses of pan
in comments, should these be roll
?
* delta *= -1; | ||
* } | ||
* | ||
* rotateX(frameCount * 0.01); |
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.
Since we're going to be doing something akin to a rotateZ
by applying the roll()
, I think it'll probably look clearer visually if we keep a vertical stack of cubes that are rotating about the vertical axis since the whole stack will be spinning clockwise/counterclockwise from the roll. That'd be the same as the cubes in the tilt
example:
rotateY(frameCount * 0.01);
translate(0, -100, 0);
box(20);
translate(0, 35, 0);
box(20);
translate(0, 35, 0);
box(20);
translate(0, 35, 0);
box(20);
translate(0, 35, 0);
box(20);
translate(0, 35, 0);
box(20);
translate(0, 35, 0);
box(20);
Yes! The camera should rotate around its own forward vector. A good approach would be to compute the camera rotation using quaternions, then compute the up and forward vectors from the resulting rotation and apply them to the camera. This demo by scudly is a good example of how to do it: https://infinitefunspace.com/p5/fly/ I made a minimal example based on it here: https://editor.p5js.org/SableRaf/sketches/WPYb6PRMu |
@haroon10725 are you still working on this? Otherwise we'll look if someone else would like to tackle it. |
@SableRaf I am busy, you can look if some one can solve it. |
If anyone else is interested in taking this up, feel free to branch off of this PR so that the work @haroon10725 has put in also gets included! A next step could be to try out the suggestion in #6819 (comment). |
Hi, |
Implemented roll function #6760