Okay, I’ll try to explain this one well… I have two gameObjects, each one with a child. Let’s call the objects p1 (first parent), p2 (second parent), c1 (child of parent1), and c2 (child of parent2).
My goal is to make c2 have the same rotation as c1, but not by rotating c2 directly, rather by rotating p2.
I have the following piece of code:
var delta:Quaternion = Quaternion.FromToRotation (c2.transform.forward, c1.transform.forward);
c2.transform.forward = delta * c2.transform.forward;
This of course rotates c2 directly and works well to get its rotation matching that of c1. However, how do I perform the rotation on p2 instead of c2? p2 and c2 don’t necessarily have the same rotations as each other, so I’m assuming I can’t just use the same delta value and replace c2 with p2 in the second line of code. I tried it thinking it might work, but it didn’t.
If anyone can help clear this up for me, I’d appreciate it. Thanks!