Roll a ball not moving :(

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

public class Playercontroller : MonoBehaviour {

public Rigidbody playerRigidbody;

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);

    playerRigidbody.AddForce(movement * speed * Time.deltaTime);
}

}

so this is the script i used, i have followed the what the video did i guess, entered the speed, checked the input part, and there isnt even any error popping up. however when i play it nothing happens (no change of value in the position and rotation) basically i have done almost all i can but it just doesnt work… i would really really appreciate if anyone can help me as i’m completely new in coding and unity… thank you so much

Howdy @yuktayuka ,

It looks to me like you’re applying the force to the wrong RigidBody :slight_smile:

In this line you get the correct component:

 rb = GetComponent<Rigidbody>();

but then in the function beneath you are Adding the force to the other RigidBody:

playerRigidbody.AddForce(movement * speed * Time.deltaTime);

So replace that line with this:

rb.AddForce(movement * speed * Time.deltaTime);

And that should work!

It’s possible you haven’t set speed.
try changing

rb.AddForce(movement * speed * Time.deltaTime);

to

rb.AddForce(movement * 5f);

just to confirm you have movement