Hi.
In the Rigidbody MovePosition method documentation, there is the following code:
void FixedUpdate()
{
//Store user input as a movement vector
Vector3 m_Input = new Vector3(Input.GetAxis(“Horizontal”), 0, Input.GetAxis(“Vertical”));
//Apply the movement vector to the current position, which is
//multiplied by deltaTime and speed for a smooth MovePosition
m_Rigidbody.MovePosition(transform.position + m_Input * Time.deltaTime * m_Speed);
}
Despite of explanation about smoothness, is it really necessary to include Time.deltaTime even the interval between calls of FixedUpdated is the same? I know we must use Time.deltaTime in the Update method because the interval between calls of the Update method is called varies during the game. But it is not the case with the FixedUpdate method…
In other words, why couldn’t the expression be like that below?
m_Rigidbody.MovePosition(transform.position + m_Input * m_Speed);
If it is really needed to include Time.deltaTime, I have another question: why not use Time.fixedDeltaTime instead Time.deltaTime? I know Time.deltaTime returns Time.fixedDeltaTime when called inside FixedUpdate, but why not type Time.fixedDeltaTime there directly?
Thanks in advance.
Helcio.