Hello everyone,
I'm really new to Dialogue System and I'm actually working on a game using it , so far everything is working great my problem here is that I have this sequence where I talk with an npc then he's supposed to use a "Move " animation so that he moves away from me and then use another animation "Jump" so that he jumps when the last animation is done, the problem here that when the move animation is finished he goes back to his start position and then it jumps and i actually want it to jump in the position that ends with the first animation
I hope this explains correctly what I'm describing
thank you <3
NPC animation transitions
Re: NPC animation transitions
Hi,
Thanks for using the Dialogue System!
Use root motion.
"Move" animations usually work in one of two ways:
1. In Place: The animation plays in place. For example, it moves the model's feet up and down, but it doesn't actually move the model forward in 3D space. When using in-place animation, a separate process moves the character's GameObject forward in parallel with the animation.
2. Root Motion: The animation not only moves the model's feet up and down, but it also moves the entire GameObject forward in 3D space. To do this properly in Unity, the Animator component extracts the motion of the model's root object. Otherwise, the animation would move the model relative to the position of its GameObject. For example, consider a walk animation that moves forward 3 units. The GameObject starts at (0,0,0), and thus the model is at (0,0,0). If the Animator didn't remove the motion, the animation would move the model to (0,0,3) but the GameObject would still be at (0,0,0). Then when you play the "Jump" animation, the model would snap back to (0,0,0). That's the problem you're seeing now.
By extracting the root motion, the model stays at the same position as the GameObject. While the Animator component plays the animation, it can apply the extracted root motion to the GameObject itself, which moves the entire GameObject to (0,0,3). Then when you play the "Jump" animation, it will also play at (0,0,3) since that's where the GameObject is.
If it's not possible for whatever reason to use root motion, you can use an in-place "Move" animation in conjunction with a MoveTo() sequencer command. Example:
Thanks for using the Dialogue System!
Use root motion.
"Move" animations usually work in one of two ways:
1. In Place: The animation plays in place. For example, it moves the model's feet up and down, but it doesn't actually move the model forward in 3D space. When using in-place animation, a separate process moves the character's GameObject forward in parallel with the animation.
2. Root Motion: The animation not only moves the model's feet up and down, but it also moves the entire GameObject forward in 3D space. To do this properly in Unity, the Animator component extracts the motion of the model's root object. Otherwise, the animation would move the model relative to the position of its GameObject. For example, consider a walk animation that moves forward 3 units. The GameObject starts at (0,0,0), and thus the model is at (0,0,0). If the Animator didn't remove the motion, the animation would move the model to (0,0,3) but the GameObject would still be at (0,0,0). Then when you play the "Jump" animation, the model would snap back to (0,0,0). That's the problem you're seeing now.
By extracting the root motion, the model stays at the same position as the GameObject. While the Animator component plays the animation, it can apply the extracted root motion to the GameObject itself, which moves the entire GameObject to (0,0,3). Then when you play the "Jump" animation, it will also play at (0,0,3) since that's where the GameObject is.
If it's not possible for whatever reason to use root motion, you can use an in-place "Move" animation in conjunction with a MoveTo() sequencer command. Example:
Code: Select all
AnimatorPlay(Move);
MoveTo(Ledge,,3); // Move GameObject to Ledge over 3 seconds.
AnimatorPlay(Jump)@3 // After moving the GameObject, jump.