Closed trusktr closed 8 years ago
The rotation component converts the node rotation from a quaternion to euler angles and then operates on those. Therefore it won't give you smooth rotations. If you want to a slerp, you can use the Transitionable directly through a custom component. Transitionables accept a method
argument for that: https://github.com/Famous/engine/blob/master/transitions/Transitionable.js#L115
@alexanderGugel In what format does Node#getRotation
return a quaternion, [w,x,y,z]
or [x,y,z,w]
?
Just curious because I'm gonna do something like this:
let goToRotation = cardFamousNode.goToNode.getRotation()
let euler = new Vec3()
new Quaternion(
goToRotation[0], goToRotation[1], goToRotation[2], goToRotation[3]
).toEuler(euler)
cardRotation.set(euler[0], euler[1], euler[2], {
duration: 2000,
curve: 'inOutExpo'
}, function() {
I was just curious because the order of args in Node#setRotation
is inconsistent with Quaternion#constructor
.
I can't get it to work. I'm also trying
new Quaternion(
goToRotation[3], goToRotation[0], goToRotation[1], goToRotation[2]
).toEuler(euler)
in the previous example. If I just use
cardRotation.set(goToRotation[0], goToRotation[1], goToRotation[2], {
then it works, but when I rotate the containing view away from [0,0,0] then all the rotations are funky.
It's [x, y, z, w]
(https://github.com/Famous/engine/blob/master/core/Node.js#L256).
Nodes don't use the Quaternion
class. Just pass in x, y, z, w as arguments explicitly (Node#setRotation(x, y, z, w)
).
Feel free to reopen.
It doesn't line up with
Node#setRotation
's ability to accept a quaternion. How do we set a quaternion withRotation#set
inherited fromPosition#set
?