I have a new project, all settings default with a simple cube on a plane. Cube is not kinematic but is a rigid body under the effects of gravity. I'm trying to normalize the direction before I translate it to prevent diagonal movement from being too fast. The movement is perfectly smooth when I just translate by the speed, but when I try to normalize it and multiply that vector, the movement becomes jittery and feels delayed, almost. I have no idea what the cause could be. Here's the code in question. It takes place in the Update()
override:
float directionHorizontal = Input.GetAxis("Horizontal");
float directionVertical = Input.GetAxis("Vertical");
Vector3 translationDirection = new Vector3(directionHorizontal, 0, directionVertical);
translationDirection.Normalize();
translationDirection *= Speed * Time.deltaTime;
transform.Translate(translationDirection);
EDIT: After some further tinkering and testing, I'm finding that the problem is more specifically that the movement seems to jump from frame to frame rather than move smoothly from one spot to another. It seems like it's moving the right speed, but this kind of really fast start/stop gives it that jerky feel.
Is this normal behavior? Shouldn't the delta time multiplication smooth out the movement and give it a more interpolated feel? This happens even if i avoid the normalization method and just multiply the axis by speed and time.
Normalize()
that's causing the jitter? You can easily verify by commenting just that one statement out. \$\endgroup\$Update
orFixedUpdate
? \$\endgroup\$