Question by
badle1711 · Feb 03, 2021 at 11:00 PM ·
scripting beginnerballtutorialsroll a ball
Can't get my ball to roll.
Hello, I just got done coding the movement section on the rollaball tutorial. I have gone through the tutorial several times but still seem to be missing something. I have checked that the script, input and input actions are added. The Console shows no errors in code but here it is anyway.
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem;
public class playerController : MonoBehaviour { public float speed = 0;
private Rigidbody rb;
private float movementX;
private float movementY;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Onmove(InputValue movementValue)
{
Vector2 movementVector = movementValue.Get<Vector2>();
movementX = movementVector.x;
movementY = movementVector.y;
}
void FixedUpdate()
{
Vector3 movement = new Vector3(movementX, 0.0f, movementY);
rb.AddForce(movement * speed);
}
} Do you see any issues?
Comment
Your answer
Follow this Question
Related Questions
How to make an orbiting camera around the TANKS! tutorial map? 0 Answers
Ball doesn't roll in roll-a-ball for mac 0 Answers
Make the ball passing through a hole 1 Answer
roller Ball for android 0 Answers