Hey there!
I’ve heard that FixedUpdate is the better one for Physics, but even so, I still don’t know where to put my movement code:
float XInput = Input.GetAxis("Horizontal");
float ZInput = Input.GetAxis("Vertical");
Vector3 moveVector = transform.forward * ZInput + transform.right * XInput;
cc.SimpleMove(Vector3.ClampMagnitude(moveVector * movementspeed, movementspeed));
Should this code be in Update or FixedUpdate and why?
Thank you a lot!
I’ll be honest I’m not super familiar with CharacteController.SimpleMove but I think that it should be in regular Update (). Update () is called at the beginning of every frame while FixedUpdate () is called every physics calculation.
I don’t know how it works too well in depth but basically FixedUpdate () is called many times per frame and you’re right should be used with most physics related things. However since you’re getting the player’s input and using that to move something and the players input is only updated every frame, there would be no point in using FixedUpdate () as you would just be moving the object multiple times in the same direction every frame.