So I created a basic script which moves a Scriptable
Camera around according to what you press.
RunService.RenderStepped:Connect(function() --// TODO: Create Limit if CanMoveCamera then cam.CFrame = cam.CFrame + movement end end)
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.
--Make a part that can be shaped as a box, because that's what you are kinda wanting.
Make this function in that same script.
game.Workspace.PARTNAME.TouchEnded:connect(function(hit) CanMoveCamera = false end