Roll a ball - the ball does not move??

hello,

I’m totally new to Unity and via the tutorials I’m trying to setup the first Roll a ball project.
I have setup according to the tutorial the various aspects.
Bu t I cannot move the ball one single inch.

below you can find the code that I have used.
Whatever I doo the ball does not move.

either I’m missing something or I made an error but I seem not able to find it.

thanks for your help.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class playercontroler : MonoBehaviour {

    public float speed;

    private Rigidbody rb;

    void start ()
    {
        rb = GetComponent<Rigidbody>();
    }

    void Fixedupdate ()
    {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");

        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

        rb.AddForce(movement * speed);
    }
}

Thank you for pointing this out to me.
It is working now.

Hi there! I wrote comments to the problem parts.

// Added default value.
        public float speed = 5.0f;

        private Rigidbody rb;
        // Start function has to be capitalized: start() -> Start()
        void Start()
        {
            rb = GetComponent<Rigidbody>();
        }
        // FixedUpdate function has to be capitalized: Fixedupdate() -> FixedUpdate()
        void FixedUpdate()
        {
            float moveHorizontal = Input.GetAxis("Horizontal");
            float moveVertical = Input.GetAxis("Vertical");

            Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

            rb.AddForce(movement * speed);
        }

Mine wasn’t working either, so I looked through my inspector to see what wasn’t connecting…


Under Player Input I had no action applied. I clicked on the little dot on the side of it and found InputActions (Input Action Asset) and selected it. Now controls are applied and are working. !!!


Thanks, I had already found out about it. I had faced the same problem.