Can I control object rotation on playing animation?
Can I control object rotation on playing animation?
I've always been thinking that affected animation node does not control.
Was I wrong?
the node is playing animation now. however I was able to modify parameter by following this code.
function Update() {
transform.rotation =
Quaternion.Euler( defaultEuler.x + x, defaultEuler.y + y, defaultEuler.z + z );
}
I tried made a same situation by using easy object(cube premitive object).
But object does not move. Parameter follows animation.
I'm not sure this cause.
and, Object that I can control rotation on playing animation does not move by using this code.
function Update()
{
transform.rotation = Quaternion.Slerp(
transform.rotation,
Quaternion.Euler( defaultEuler.x + x, defaultEuler.y + y, defaultEuler.z + z),
Time.deltaTime * chaseCameraSpeed );
}
Object state that shaking slightly(Brr). I'm not sure really...
Can I control object that affected by playing animation?
Answer by Owen-Reynolds · Jan 27, 2012 at 04:40 PM
Your English is a little weak, but I think adequate. The question needs more details about the set-up.
Most animations were created in a modelling program, on bones. Since you're talking about a Cube, I'm guessing that you created the animation using Unity's animation window, and added it to the Cube, as a Component.
Animations fully control the rotation/transform of the object they are on. They run after Update (and before LateUpdate,) so they override your Update code. The trick is to animate the child and code-move the parent:
square <- empty game object. Update script can move this
Cube <- cube made in Unity. Has animation component
Thanks for the answer.
sorry, I am studying English little by little.
I didn't know that animation update moment.
I think that this problem is diffrent of update method I call.
I could change rotation of object on playing animation using LateUpdate method.
Thank you so much.
Answer by duc · Feb 17, 2012 at 02:17 AM
hey, i want the animation of the cube which is a simple rotate to be played only when i clic on left mouse! how can i do that ? help please and thank you
Answer by Pau678 · Dec 01, 2018 at 01:01 PM
public animation anim;
if (Input.GetMouseButtonDown(1))
{
anim.Play("NameOfTheAnimation");
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613063448im_/https://answers.unity.com/themes/thub/images/avi.jpg)