- Home /
Having an issue with multiple animations on an object
So i have a simple projectile game in which you and the gorilla are going in the same direction automatically and you have to shoot him to keep him away. Now my problem is that i have two animations on the gorilla, one of him moving and another of him going side to side (dodging). My problem is that when i run the game the moving animation plays, but not the dodging one and he doesn't automatically move straight like he's supposed to with the script he just stays there.
Here is the script i was referring to. You pick a game object as the target and the player and gorilla move towards it.
// The target marker.
var target: Transform;
// Speed in units per sec.
var speed: float;
function Update() {
// The step size is equal to speed times frame time.
var step = speed * Time.deltaTime;
// Move our position a step closer to the target.
transform.position = Vector3.MoveTowards(transform.position, target.position, step);
}
You script doesn't reference the animation at all.
You walk anim is playing automatically. If you are using $$anonymous$$ecanim you need to link speed to a parameter in Animator. Are you supposed to be moving by root motion? If so, dont use transform.position (you shouldn't anyway as it teleports). If not, disable root motion.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Loop animation on button hold 2 Answers
Rotating An Object On Its Axis Once 3 Answers
C# Make Child Not Animate Looped Animation 1 Answer
How To Make Enemy Chase You? 1 Answer