- Home /
Question by
navid_gh · Jul 01, 2014 at 05:54 PM ·
rotationquaternionanglecube
Calculate rotation angle for two side of cube ( like dice ) from Quaternion.identity
Hi, I want to know how I can calculate rotation angle from Quaternion.identity to specific two side ( Top and Front side )
For instance I want to select two top side and front side from inspector my code is this but If I select first position of top side always front is same as first position of that but if I change top side for example in dice ( 2 is top 5 is bottom and front is 3 ), it works.
I hope I could explain my problem clearly. Sorry for my bad English.
float angle = Quaternion.Angle (Quaternion.identity, currentFrontRotation * currentTopRotation);
newRotation = Quaternion.AngleAxis (angle, Vector3.zero) * currentTopRotation;
Comment