beek
beek

Reputation: 3746

Three.js reverse lookAt(camera.position)

I'm tweening objects towards the camera and want them to face the camera when arriving, so I'm using object.lookAt(camera.position)

I now need to tween this object back to it's original rotation and I can't find a way of undoing this lookAt, i.e. it won't tween back to it's original rotation, any ideas?

Upvotes: 1

Views: 1076

Answers (1)

serious_luffy
serious_luffy

Reputation: 419

first of all check out the quaternion befor your object looks at towards camera position. with this piece of code.

var myqt = your_Object.quaternion. (if it is an instance of mesh)

fine, now our object is looking at the camera and. now check out the quaternions again. i am sure you will find a different output.

now after performing the operation we need to get back to previous state. so, just set the quaternions with that.

myqt.quaternion.set(myqt);

thanks :)

Upvotes: 1

Related Questions