EDIT: I forgot to mention I use the roll-a-ball tutorial movement to move my sphere if that helps
I’ve spent hours trying to find a solution to this problem. The tags are in place. I try to move OnCollisonEnter to void Update() and it just creates tons of error no matter what I enter or remove. Please don’t be cryptic with your answer or to look more into it because I’ve done that for 6 hours all ready.
using UnityEngine;
using System.Collections;
public class Jump : MonoBehaviour
{
public bool OnGround;
private Rigidbody rb;
void Start()
{
OnGround = true;
Debug.Log("OnGround set to true in Start");
rb = GetComponent<Rigidbody>();
}
void Update()
{
if (OnGround)
{
if (Input.GetButton("Jump"))
{
rb.velocity = new Vector3(0.0f, 10f, 0.0f);
OnGround = false;
Debug.Log("OnGround set to false in Update");
}
else
{
}
}
}
void OnCollisonEnter(Collision other)
{
Debug.Log("Collision entered with tag named: " + other.gameObject.tag);
if (other.gameObject.CompareTag("Ground"))
{
OnGround = true;
Debug.Log("OnGround Set To true in OnCollisionEnter, collided with tag: " + other.gameObject.tag);
}
else
{
OnGround = false;
Debug.Log("OnGround Set To false in OnCollisionEnter, collided with tag: " + other.gameObject.tag);
}
}
}