Hello, I am new to unity and was the following beginner game tutorial videos from Brackeys and everything was going absolutely fine until I hit a brick wall from no where. Just yesterday, my cube was moving perfectly and it was such a great feeling but today I ran my game without changing anything and it just won’t move. I have no idea why and I have been trying to solve this problem for almost 5 hours with no luck. This is my rigidbody and the force and sideways force I am applying to my cube:
This is my player movement code:
using UnityEngine;
public class PlayerMovement2 : MonoBehaviour
{
public Rigidbody rb;
public float forwardForce = 2000f;
public float sidewaysForce = 100f;
// Update is called once per frame
//Fixedupdate is for unity physics, update is for anything else that's not in the start() and does not include physics
void Update()
{
//add a forward force
rb.AddForce(0,0, forwardForce * Time.deltaTime);
if (Input.GetKey("d")) {
rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
}
if (Input.GetKey("a")) {
rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
}
}
}
I would really like to know the problem here and how to solve it.