S
S
SimpleQuest2014-10-27 13:32:04
Unity
SimpleQuest, 2014-10-27 13:32:04

Skids / rubber band in control, how to control it?

tutorial: https://unity3d.com/learn/tutorials/projects/space...
the control is carried out with the keys, when holding it, the allowable value is exceeded by .2 and returned back, with an increase in the speed variable, the skid increases. How to increase / decrease the rubber effect?
inspector Player: i.imgur.com/IjR6vw6.png control
script:

public class Boundary {
  public float xMin, xMax, zMin, zMax;
}

public class PlayerController : MonoBehaviour {

  public float speed;
  public Boundary boundary;

  void FixedUpdate() {
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveHVertical = Input.GetAxis("Vertical");

    Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveHVertical);
    rigidbody.velocity = movement * speed;

    rigidbody.position = new Vector3(Mathf.Clamp(rigidbody.position.x, boundary.xMin, boundary.xMax), 0.0f, Mathf.Clamp(rigidbody.position.z, boundary.zMin, boundary.zMax));
  }

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Khlopianik, 2014-10-27
@SimpleQuest

If you do not change the logic, then you will have to change the Input settings:
Edit->Project Settings->Input->Axes->Horizontal -> Increase Gravity - how quickly the equilibrium value is set when the button is released (in this case, how quickly we get 0 after releasing the button ).
PS well, for Vertical too, if necessary

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question