Hi, I have these two functions on a player controller I'm making. They're executed in Update:
{
Vector3 inputDir = transform.forward * look.y + transform.right * look.x;
if (inputDir != Vector3.zero)
{
transform.forward = Vector3.Slerp(transform.forward, inputDir.normalized, Time.deltaTime * lookSensitivity);
}
}
private void MoveBasic()
{
if(playerRb == null)
{
Debug.LogWarning($"ThirdPersonController[MoveBasic]: No coreRb assigned.");
}
Vector3 moveDirection = transform.forward * move.y + transform.right * move.x;
moveDirection.Normalize();
// Handle speed variation
float activeBoost = 1.0f;
if (isBoosting)
{
activeBoost = boostPower;
}
float speed = baseSpeed * activeBoost;
playerRb.linearVelocity = new Vector3(moveDirection.x * speed, playerRb.linearVelocity.y, moveDirection.z * speed);
}```
They're driven by Unity Input Action (joystick/mouse vector2, etc). My problem is there's jitter on the object when both look and movement inputs happen. Any advice? I was following a couple tutorials and ended up with this because their explanations didn't actually work - so this is as far as I've gotten.
The object hierarchy is:
- Player (has the rigidbody)
- - Capsule (has visuals)
- - CamTarget
Where a third person aim cinemachine camera is tracking the CamTarget (Position control is Third Person Follow, and no Rotation Control).