11 lines
303 B
JavaScript
11 lines
303 B
JavaScript
AFRAME.registerComponent('rotation-limiter', {
|
|
tick: function () {
|
|
var el = this.el;
|
|
var rotation = el.getAttribute('rotation');
|
|
|
|
rotation.x = Math.max(0, Math.min(90, rotation.x));
|
|
rotation.y = Math.max(0, Math.min(90, rotation.y));
|
|
|
|
el.setAttribute('rotation', rotation);
|
|
}
|
|
}); |