I don’t believe my mistake is on the code as even if deleting my whole thing and pasting the code from the instructor, the ball still doesn’t rolls.
In my Ball Inspector I have Sphere Collider checked on, the mass set to 7,3 and LaunchSpeed set to 200.
I tried to reproduce all the steps on the video the same way as the instructor… and I can’t find my error.
My Unity version is 2017.3, and the code is pasted below.
Thank you for any help!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ball : MonoBehaviour {
public float launchSpeed;
private Rigidbody rigidBody;
private AudioSource audioSource;
// Use this for initialization
void Start () {
rigidBody = GetComponent<Rigidbody>();
audioSource = GetComponent<AudioSource>();
Launch();
}
public void Launch() {
rigidBody.velocity = new Vector3(0, 0, launchSpeed);
audioSource.Play();
}
// Update is called once per frame
void Update () {
}
}