Hi All,
Im struggling with clamping my character to the camera bounds. For some reason when the character reaches the clamp it begins to jitter. I have tried different force methods, clamp positions vs velocity but I really do need some help as I am not a very experienced coder.
The project is a side scroller using 3d meshes and the character needs to feel like a drone which is why I am using addforce instead of position.
transform.position = new Vector3(transform.position.x, Mathf.Clamp(transform.position.y, -2f, 5.1f), transform.position.z);
//input region for managing the movement of the character
//Upwards movement
if (Input.GetAxis(“Vertical”) > 0.0f)
{
//rigidbodyCharacter.AddForce(0, Upwardthrust, 0, ForceMode.Acceleration);
rigidbodyCharacter.AddForce(0, Upwardthrust, 0, ForceMode.Force);
}
Any ideas?