Skip to content

Conversation

@vincentfretin
Copy link
Member

This closes #394

It doesn't make sense to me to copy the rotation from camera to the camera rig. That's why we have the issue that the camera jumps when first touching the joystick (first issue), and second issue it jumps again if some other component modified the camera rig rotation because it wasn't copied before doing the calculation.
My guess is that code was written/thought when we didn't use camera rig, if movement-controls and camera with look-controls was on the same entity, the code made sense. That's not the case today.
I may have overlooked something, so if someone can review that and test it, I'll appreciate it.

Changes proposed:

  • Remove rotation copy from look-controls and remove camera from the component properties
  • Copy camera rig rotation before doing the rotation calculation

@vincentfretin
Copy link
Member Author

vincentfretin commented Dec 10, 2022

I tested with the Quest joysticks only.

@vincentfretin
Copy link
Member Author

You can reproduce the first issue if you have rotation="0 90 0" on camera rig for example.
You can reproduce the second issue if you change dynamically camera rig rotation to something else rotation="0 0 0" or rotation="0 -90 0" for example.

@vincentfretin
Copy link
Member Author

Oh I see that previously the code changed the camera rotation, not the camera rig rotation. The behavior changed in https://github.com/n5ro/aframe-extras/pull/373/files#diff-87251e16fae2ca8e4158c45c3374b3446d1f0a9546f2cfac67a43f416163b623
but I believe the changes in this previous PR were correct. You can't really change camera rotation in VR right? This get overridden right away by your real head rotation.

@vincentfretin vincentfretin force-pushed the gamepad-controls-rotation branch from 349a297 to b7cab0c Compare December 10, 2022 12:01
@vincentfretin
Copy link
Member Author

I rebased since I merged another fix.

You can test with the build of this PR:
https://cdn.jsdelivr.net/gh/n5ro/aframe-extras@b7cab0c/dist/aframe-extras.min.js

I'll merge those changes in a few days if I don't have any feedback.

// First copy camera rig pitch/yaw, it may have been changed from
// another component.
yaw.rotation.y = this.el.object3D.rotation.y;
pitch.rotation.x = this.el.object3D.rotation.x;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is coherent with what we do in init().

@vincentfretin vincentfretin merged commit 09b8445 into master Dec 14, 2022
@vincentfretin vincentfretin deleted the gamepad-controls-rotation branch December 14, 2022 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[gamepad-controls] camera jump initially when using the right joystick

2 participants