- Home /
equalize different degrees
i really need help
i have 2 object, I want object2 to look in the same direction as object1 by changing the degree value of object2, when degree of object1 is 270 then degree value of object2 changing to 0, so on when the degree of object1 is 45 then the degree value of object2 changes to 225, how can i do that ???
Answer by ecv80 · Dec 04, 2018 at 11:20 AM
Without knowing more about your project it's hard to guess how it's all set up, but mathematically:
Since the direction of object2 is opposite to that of object1, first you need to reverse it:
Say object1 is 270 degrees, then 360-270=90.
Now you need to add the offset which is 90:
object2 degrees = 90-90 = 0
Say object1 is 45 degrees, then 360-45=315.
Now you need to add the offset which is 90:
object2 degrees = 315-90 = 225
That said, my answer is rather abstract, and I think @Defetysta 's answer is indeed the easiest and most pragmatic.
Answer by Defetysta · Dec 04, 2018 at 09:23 AM
I think easiest solution would be to create empty GameObjects, make them parents of your objects and rotate them the same way around.