How to limit a CFrame/Camera to be bound to a set area?
So I created a basic script which moves a Scriptable
Camera around according to what you press.
1 | RunService.RenderStepped:Connect( function () |
4 | cam.CFrame = cam.CFrame + movement |
movement
is a Vector3
value. It changes when I press certain keys. Like, if I press W, it will get a number, or the speed, added to its X value. This would cause the camera to move while the key is pressed.
I want to know how I could limit this camera to be bound to a box/ rectangular area.
I tried checking the position of the camera before changing movement, but that became very long and tedious, and didn't even really work.
Thanks for any help.