svetagoldstein
svetagoldstein

Reputation: 43

How can I constrain rotation of an a-camera (aframe)?

For example 1.to allow rotation about z-axis only from -70 to 70 degree or 2.to block rotation about about an arbitrary axis

thnx

Upvotes: 1

Views: 1018

Answers (1)

ngokevin
ngokevin

Reputation: 13233

You can copy and paste the look-controls component: https://github.com/aframevr/aframe/blob/master/src/components/look-controls.js

As I have done at https://github.com/ngokevin/kframe/blob/master/components/reverse-look-controls/index.js

And when the component goes to update the orientation, you can constrain it yourself with something like Math.min/Math.max

Upvotes: 1

Related Questions