|
We have two types of objects we add dynamically. They can be rotated differently. A) can only rotate 90 degrees, so that gives 4 directions {0,90,180,270} B) can be rotated in 5 degress, so we have {0,5,10,15,20,25,30 ... 355} (you get the idea I think) Problem is that we make the user rotate the object and we also need to let the user switch from type A to B and back. When switching back to A, we need to make sure that the rotation matches the rule and if it doesnt, then go for the best/nearest angle. Does this make any sense to you and you have some ideas, please post them. I am stirring at this and cant come up with a nice solution. Only ugly hacks.
(comments are locked)
|
|
Mathf.Round is your friend To round to nearest 1, Mathf.Round(value) To round to nearest 5, Mathf.Round(value/5.0) * 5.0; To round to nearest 90, Mathf.Round(value/90.0) * 90.0; oh my.. so pure and simple! I was thinking in terms of Modulus etc. THANKS A LOT!
Aug 16 '11 at 10:22 PM
BerggreenDK
(comments are locked)
|
