I'm struggling to figure out how to actually implement what I'm wanting to do and was wondering if anyone could help.
I have an Orthoscopic Camera and a Rigidbody. The Rigidbody will get launched to the right (x-axis positive) direction. While it's possible to launch it to the left, there will be an invisible collider that basically stops it from moving left beyond the camera. On the y-axis, I don't care if it goes above the camera and the ground prevents it from going down.
So I want the camera to follow it in the positive x-axis direction ONLY. To make things a little more complicated, I'd like it to move with the object once it gets almost to the edge of the screen. Think like 20% left before it gets to the edge. Once the object continues in the positive x-axis position, I want the camera to keep up with it so it never goes outside the camera.
I'm thinking along the lines of mathf.clamp but I'm still unsure how to implement it so maybe I'm way off.
↧