#what is mouse delta....
1 messages · Page 1 of 1 (latest)
thats true but basically I am:
-recording mouse delta
-Changing transform rotation by that
and since it's recording delta in chunks of around like 4 or 7 depending on how fast I move the mouse, it's moving by a few degrees per frame which seems jittery and inconsistent
show the code
//Camera
private float3 lookRot = new float3();
private void OnLook(InputValue lookValue)
{
float2 lookData = lookValue.Get<Vector2>();
lookRot.xy = lookData;
if (invertYAxis)
{
lookRot.y *= -1; //invert view axis
}
lookRot.xy = lookRot.yx; //swap axes
}
private void FixedUpdate()
{
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(lookRot.x, 0f, 0f));
}
public float3 get_look_rot()
{
return lookRot;
}
//Player capsule
private void FixedUpdate(){
rb.rotation = Quaternion.Euler(transform.rotation.eulerAngles + (Vector3)GetComponentInChildren<PlayerCameraRotation>().get_look_rot().zyz);
}
You have two FixedUpdates
look at the comments
But basically it's because you're doing the rotation in FixedUpdate
those are two different scripts
input happens in sync with Update (once per frame)
FixedUpdate doesn't run every frame
so you're missing some input
that happens between the FixedUpdates
oh okay let me try that
But really you can just go ahead and do the rotation directly in OnLook