Need help with torque and angular velocity.

So I have been working on a 3D platformer with a fixed camera angle. I have already setup the camera, the player and the first scene. I made some basic movement code for my player in C#. Here it is:

  public class Movement : MonoBehaviour {
    
        public float rotationspeed = 100.0f;
    
        public float maxrot;
     
    
        // Update is called once per frame
    
        void Update () {
    
            Rigidbody rb = GetComponent<Rigidbody> ();
    
            rb.maxAngularVelocity = maxrot;
    
            var rotation = Input.GetAxis ("Horizontal") * rotationspeed;
    
            rb.AddRelativeTorque(Vector3.back * rotation);
       
        }

Now this code is good and all, but I have 1 slight problem with it. The ball/player takes forever to change direction. If I’m going full speed one way, and then I change direction. He slows down for about 3 seconds, turns, then speeds up for about 3 seconds. Any idea on how to speed this up. Also if you could help with an accelartion code, that would be very helpful. I want the player/ball to slight increase in speed as time goes on.enter code here

1 Answer

1

Hi conorpo2 i am not getting u properly what do u want to ask ??