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);
}
}
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. !!!