# applyQuaternion causing flicker

**URL:** <https://discourse.threejs.org/t/applyquaternion-causing-flicker/26252>\
**Category:** Questions\
**Created:** [May 14, 2021, 2:15pm UTC](https://discourse.threejs.org/t/applyquaternion-causing-flicker/26252 "2021-05-14T14:15:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobiascornille](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/tobiascornille/32/18217_2.png) [@tobiascornille](https://discourse.threejs.org/u/tobiascornille)\
**Post date:** [May 14, 2021, 2:15pm UTC](https://discourse.threejs.org/t/applyquaternion-causing-flicker/26252/1 "2021-05-14T14:15:24Z")

</div>

Hi! I’m trying to use applyQuaternion to update the camera rotation. I thought it would work similarly to setting `camera.rotation.x = ...`, but when I do `this.camera.applyQuaternion(quaternion);` it only causes massive flickering, and doesn’t update the rotation as I want.

This codesandbox shows the issue on a cube: [three.js bare example (forked) - CodeSandbox](https://codesandbox.io/s/threejs-bare-example-forked-gybg4?file=/index.js:1662-1699)

Can anyone point me in the right direction for using quaternions to update the camera rotation?

---

<div class="post-metadata">

**Author:** ![awonnink](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/awonnink/32/22486_2.png) [@awonnink](https://discourse.threejs.org/u/awonnink)\
**Post date:** [May 14, 2021, 4:06pm UTC](https://discourse.threejs.org/t/applyquaternion-causing-flicker/26252/2 "2021-05-14T16:06:09Z")

</div>

this.mesh.quaternion.slerp(this.quat, 0.001);  
?

---

<div class="post-metadata">

**Author:** ![tobiascornille](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/tobiascornille/32/18217_2.png) [@tobiascornille](https://discourse.threejs.org/u/tobiascornille)\
**Post date:** [May 14, 2021, 4:21pm UTC](https://discourse.threejs.org/t/applyquaternion-causing-flicker/26252/3 "2021-05-14T16:21:49Z")

</div>

> [@awonnink](#):
>
> quaternion.slerp(this.quat, 0.001);

Thanks for your answer! Is there any reason why I can’t just assign it using applyQuaternion?  
Interpolating with a super small t seems kinda hacky

---

<div class="post-metadata">

**Author:** ![tobiascornille](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/tobiascornille/32/18217_2.png) [@tobiascornille](https://discourse.threejs.org/u/tobiascornille)\
**Post date:** [May 14, 2021, 4:32pm UTC](https://discourse.threejs.org/t/applyquaternion-causing-flicker/26252/4 "2021-05-14T16:32:54Z")

</div>

To add to that, what I really want to do is to define the camera position and rotation before I render, not updating it in the render loop.

I have a set of 4 quaternion rotations and 4 translations that I wish to apply to the camera. However, no matter which code I use (camera.quaternion = …; camera.applyQuaternion(…); camera.rotation.setFromQuaternion(…);), nothing works

---

<div class="post-metadata">

**Author:** ![awonnink](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/awonnink/32/22486_2.png) [@awonnink](https://discourse.threejs.org/u/awonnink)\
**Post date:** [May 14, 2021, 6:03pm UTC](https://discourse.threejs.org/t/applyquaternion-causing-flicker/26252/5 "2021-05-14T18:03:40Z")

</div>

Not sure why you box was flickering, but maybe you shouldn’t set the rotation in the animation loop, only if you want do rotate smoothly, using slerp. (normally you would set a different rotation on an event, for example a mouse click on something).
