- Home /
Opposite angle rotation
I have an object I would like to rotate around Y axis. I'd like the object to rotate the same direction of the twist movement of the fingers
![Like This][1]
At the moment I am using FingureGesture to deal with touch events.
However when I set the rotation around the Y axis currently the following happens:
![Like This][2]
void OnTwist( TwistGesture gesture )
{
// rotate around current rotation axis by amount proportional to rotation gesture's angle delta
Quaternion qRot = Quaternion.AngleAxis( Sensitivity * gesture.DeltaRotation, GetRotationAxis() );
// apply rotation to current object
transform.rotation = qRot * transform.rotation;
}
Is there a simple way to reverse the angle?
I have tried Quaternion.Inverse, but no luck.
Thanks [1]: /storage/temp/22695-correct.png [2]: /storage/temp/22696-current.png
This line won't compile. Are you talking about Quaternion.AngleAxis(). If so, can't you just negate either the angle or the axis in the call?
Quaternion qRot = Quaternion.axis Sensitivity * gesture.DeltaRotation, GetRotationAxis() );
Sorry my bad, that should have been:
Quaternion qRot = Quaternion.AngleAxis( Sensitivity * gesture.DeltaRotation, GetRotationAxis() );
So interpreting drawing is always dicey. Do either of these work for you:
Quaternion qRot = Quaternion.AngleAxis(-Sensitivity * gesture.DeltaRotation, GetRotationAxis() );
Or:
Quaternion qRot = Quaternion.AngleAxis( Sensitivity * gesture.DeltaRotation, -GetRotationAxis() );
Both should produce the same rotation.
You legend, the top one sorted it. And i've been pulling my hair out for the last day over something that now seems so simple
Your answer
Follow this Question
Related Questions
Get slerp to work just as LookAt(,Vector3.right) does 1 Answer
Boids for 2D 0 Answers
How to use quaternion.lerp 2 Answers
Rotate object without storing facing 1 Answer
Player forward in Kinect 1 Answer