- Home /
Question by
fdDavid18 · May 02, 2019 at 08:49 PM ·
cameracamera follow
Sniper Scope clipping with a gameobject
Hi, I'm trying to scope in the image overlay when the DummyPlayer is scoping in with the sniper, it should not interfere with the background, just interact with the camera and the image.
The problem I'm having is the camera position is clipping through the player, even when I try to adjust it
My CameraFollow script:
public class CameraFollow : MonoBehaviour
{
[SerializeField] public Transform player;
[SerializeField] Vector3 offset;
private float smoothSpeed = 0.125f;
void FixedUpdate()
{
Vector3 originalCameraPosition = player.position + offset;
Vector3 smoothCameraPosition = Vector3.Lerp(transform.position, originalCameraPosition, smoothSpeed);
transform.position = smoothCameraPosition;
transform.LookAt(player);
}
}
I'm confused on how the camera should work so I appreciate any tips/methods everyone has worked with.
Thanks.
scope-overlay.png
(386.0 kB)
sniperparent.png
(3.3 kB)
Comment