I’ve been trying to get my character to jump for the past day and I can’t get anything to work. Its not just jumping though, I can’t use addforce on the y axis at all. I think something is sticking my character to the ground and I know it’s not my only other script I have added (the one to let me move with a,w,s,d) because I tried turning off that script and the problem persisted. I have a character controller, rigidbody (NOT kinematic), and an animator. I think it could have something to do with my animations (I have an idle animation and a running animation when I would move) that’s keeping my character from going up on the Y axis but I still don’t know what to do PLEASE HELP
Here is my Jump Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Jump : MonoBehaviour
{
public float speed = 10f;
public Rigidbody rb;
private void Start()
{
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
float vertical = Input.GetAxis("Vertical") * Time.deltaTime * speed;
transform.Translate(horizontal, 0, vertical);
if(Input.GetKeyDown(KeyCode.Space))
{
rb.AddForce(new Vector3(0, 5, 0), ForceMode.Impulse);
}
}
}