aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.61k stars 3.94k forks source link

Request: look-controls reverseTouchDrag #2547

Open doughamlin opened 7 years ago

doughamlin commented 7 years ago

Currently, you can use the following to invert the scroll direction of a camera on desktop: <a-entity camera look-controls="reverseMouseDrag: true"></a-entity>

This, however, does not work on mobile; it would be useful to have a reverseTouchDrag option for mobile.

ngokevin commented 7 years ago

Thanks for filing! There's a PR open right now.

jason90929 commented 7 years ago

I have done it in my fork, branch: project-custom-0.5.0 and find keyword reverseMouseDrag. It's simple to add condition

l2aelba commented 7 years ago

What about this (shorter code) ? @ngokevin @dmarcos

var modifier = this.data.reverseMouseDrag ? -1 : 1;
rotation = {
  x: ( radToDeg(hmdEuler.x) + radToDeg(pitchObject.rotation.x) ) * modifier,
  y: ( radToDeg(hmdEuler.y) + radToDeg(yawObject.rotation.y) ) * modifier,
  z: radToDeg(hmdEuler.z)
};
Utopiah commented 6 years ago

Proposed https://github.com/aframevr/aframe/pull/3761

l2aelba commented 6 years ago

@Utopiah Oh thanks, I tho this is added a long time ago. But still not?

Utopiah commented 6 years ago

@l2aelba not AFAIK cf https://github.com/aframevr/aframe/blob/master/src/components/look-controls.js#L19 but I might be missing something

l2aelba commented 6 years ago

@Utopiah I am not sure also. But I see something for directions in the doc.

https://aframe.io/docs/0.8.0/core/animations.html#attributes_direction

Long time I am using aframe :D

Utopiah commented 6 years ago

@l2aelba that's related to entity animation (being replaced by the way, cf https://github.com/aframevr/aframe/pull/3678) and has no relation with look controls.

l2aelba commented 6 years ago

@Utopiah Aha ! So thanks so much.

l2aelba commented 6 years ago

@Utopiah closing?