|
Hello, I'm working in this Robot-Toy, I am trying to fix the rotation of the arm, but the Arm rotates keeping the same orientation don't change (always see to the same direction). (The Base's Arm (in color green) rotates well, but the Arm as a "children" rotates keeping the same orientation) Please take a look to the image.
Here it is the Script I am using for the base in green color.
And here it is the script for the arm " who has to rotate according to the arm but it doesn't (It rotates but always keeping the same orientation)
Any advice is welcome.
(comments are locked)
|
|
Your code should rotate the whole hierarchy. It sounds to me that your children have some code affecting their world rotation somehow. Are there other scripts involved?
In your updated code you set rotation this way:
This sets the world rotation (absolute rotation) of the object. You likely want to set the local rotation, so hierarchy rotations are preserved. This is done simply.
Likewise, you should store the localRotation in your Start function. Hi Statement, Yes you help me to make the scripts for the arm, not for the base. here you can see the scripts, but let me rephrase my question for Paulius Liekis. Please take a look to my thread
Jan 11 '11 at 06:45 PM
paco morales
I have updated my answer. Basically you are overwriting the world rotation every frame. You should set the local rotation instead.
Jan 11 '11 at 07:23 PM
Statement ♦♦
Thanks Man it works !!! I owe you a bottle of Tequila :)
Jan 11 '11 at 08:23 PM
paco morales
Where can I collect it? :D
Jan 11 '11 at 08:47 PM
Statement ♦♦
You can collect it here in Mexico or I can pay you the cost of it, But I don't know about prices in Sweden I think is a little expensive than Mexico :)
Jan 13 '11 at 09:18 PM
paco morales
(comments are locked)
|


Could you rephrase your question? It's very unclear which parts you want to rotate and which you want to keep static. Because basically if you parent some thing and then rotate parent, then children will rotate with parent.
Love the pictures.