Rigidbody jittering (Interpolation set on)
I'm making a game that's basically 3D Flappy Bird. My player is currently just a cube with a rigidbody and this component:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class Player : MonoBehaviour
{
private InputMaster controls;
public Rigidbody rigidbody;
public float flapForce = 10;
void Awake()
{
controls = new InputMaster();
controls.Player.Jump.performed += ctx => Jump();
controls.Player.Dive.performed += ctx => Dive();
}
private void Update() {
// Make the player face the way they're moving
transform.rotation = Quaternion.LookRotation(rigidbody.velocity);
}
void Jump()
{
rigidbody.velocity = new Vector3(flapForce * controls.Player.Move.ReadValue<float>(), flapForce);
}
void Dive()
{
rigidbody.velocity = new Vector3(flapForce * controls.Player.Move.ReadValue<float>(), Mathf.Min(-flapForce, rigidbody.velocity.y));
}
private void OnEnable() {
controls.Enable();
}
private void OnDisable() {
controls.Disable();
}
}
The player is also followed by a Cinemachine camera. Somehow the combination of all this makes the cube jitter noticably on screen doing basic movements, even though the player's rigidbody is set to Interpolate. Any way to prevent this?
Comment
Your answer
Follow this Question
Related Questions
Making a pivot focused game 0 Answers
Player (RigidBody) jitters when colliding with object and jumping. 0 Answers
How to stop jitter on rigidbody? 0 Answers
Stuttering with moving Rigidbody 1 Answer
AddForce in Coroutine 1 Answer