So I have a ship that moves like this:
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal , moveVertical, Mathf.Max(rb.velocity.z, forwardSpeed));
rb.velocity = movement * speed;
transform.position = new Vector3
(
Mathf.Clamp(rb.position.x, moveBoundary.xMin, moveBoundary.xMax),
Mathf.Clamp(rb.position.y, moveBoundary.yMin, moveBoundary.yMax),
rb.position.z
);
transform.rotation = Quaternion.Euler(rb.velocity.y * -tilt, rb.velocity.x * tilt, rb.velocity.x * -tilt);
}
(moveboundary
is a Boundary
which just has 4 float parameters)
But when I bump the player against the boundary I get jittering. Should I not be using physics for this movement?