- Home /
Animation script gravity problem
Hi guys i have a problem with the Animation script I follow a tutorial to make a animation sistem and it's work fine but i have a big problem When i use the script for animation my character had like a different gravity , i can climb the mountain easy and when i jump it's not working ... Someone know how to fix that ? :) This is the animation script : using UnityEngine; using System.Collections;
public class PlayerAnnimationSystem : MonoBehaviour {
public Animator anim;
public Rigidbody rbody;
private float inputH;
private float inputV;
// Use this for initialization
void Start ()
{
anim = GetComponent<Animator>();
rbody = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown ("1")) {
anim.Play ("Attack2", -1, 0f);
}
if (Input.GetKeyDown ("2")) {
anim.Play ("Action", -1, 0f);
}
inputH = Input.GetAxis ("Horizontal");
inputV = Input.GetAxis ("Vertical");
anim.SetFloat ("inputH", inputH);
anim.SetFloat ("inputV", inputV);
float moveX = inputH*50f*Time.deltaTime;
float moveZ = inputV*50f*Time.deltaTime;
if (moveZ <= 0f) {
moveX = 0f;
}
rbody.velocity = new Vector3(moveX,0f,moveZ);
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612061234im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
why I have to anim.getComponent in update() function when I had done in Start () function 2 Answers
First script plays animation but second script stops if from playing said animation 1 Answer
Scale up/down animator not staying at the scale once the animation finishes 2 Answers
Animating a Panel,Animating a panel 1 Answer
How can i impliment my animations (run to walk) in this script 0 Answers