I am moving rigidbodies around with velocity.
Is simply using
function FixedUpdate(){
thisRigidbody.velocity.x = movement.x;
}
enough to make the movement framerate INDEPENDENT. versus
function FixedUpdate(){
thisRigidbody.velocity.x = movement.x * Time.deltaTime;
}
Which seems to slowdown my game.
Thanks in advance!
It is slower with Time.deltaTime because this value is always lesser than 1.
In fact it does not make sense to set the velocity using Time.deltaTime since a velocity is already integrating the time. You need to use this value when you set a position using a value that is a velocity. This is basic middle school physics:
velocity is a value which unit is in m/s
time is a value which unit is in s
position is a value which unit is in meters (m)
Therefore:
position = velocity * time (m = m/s * s)
It would make sense if movement
was an acceleration vector, but I don’t think that it is the case here.
The FixedUpdate already is framerate-independent.
I suggest you try to learn the exact difference between Update() and FixedUpdate ().
They correspond to Time.deltaTime and Time.fixedDeltaTime.
EDIT: like Kryptos pointed out, the Time.deltaTime inside a FixedUpate indeed does return the fixed timestep as mentioned in the documentation. I wasn’t aware of that.