Hi,
I have been working on Roll a ball type game. Where i want to rotate the rigid-body on X-axis and rigid-body transform on Y-axis. I know rigidbody rotation and transform rotation are not good friends. After applying rotation it gives jitter effect.
Please help me how i can fix this issue.
void FixedUpdate()
{
if (applyBrakes) { rb.velocity = rb.velocity * 0.85f; return; }
var localInput = moveHorizontal * cvCam.right + moveVertical * cvCam.forward;
var templocal = transform.InverseTransformDirection(localInput).normalized;
m_TurnAmount = Mathf.Atan2( templocal.x , templocal.z );
localInput.y = 0;
rb.angularVelocity += new Vector3(localInput.z , 0 , -localInput.x) * force * Time.fixedDeltaTime;
print(m_TurnAmount * Time.fixedDeltaTime * 360);
transform.Rotate(Vector3.up , m_TurnAmount * Time.fixedDeltaTime * 360 , Space.World );
if (rb.velocity.magnitude > maxVelocity)
{
rb.velocity = rb.velocity.normalized * maxVelocity;
}
}