Hello, I’m just learning Unity, I created a player object which is traveling/sliding on a level ground, ground has 0 friction, it worked perfectly, now I added some obstacles and stuff on the ground, and the player started to tumble all of a sudden, I didn’t change anything in code regarding to player movement, I can’t find anything that might be the problem.
Here is the player movement code:
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public Rigidbody rb;
public float forwardForce = 2000f;
public float sidewaysForce = 500f;
public float upwardForce = 50f;
// Update is called once per frame
void FixedUpdate()
{
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);
}
if (Input.GetKey(KeyCode.Space))
{
rb.AddForce(0, upwardForce * Time.deltaTime, 0);
}
}
}