Treating the camera as an object?

my goal is to add fog locally when the players camera is under custom made water which is just a part called “waterpart”. but before I got far I could not get the position of the players camera.

is it possible to treat the camera as an object with it having most if not all the same properties as any other part.

before anyone says why dont I just use the players character the problem with that is if the players camera is under water but not their character the fog wont appear. thats were using the camera instead becomes relivant.

1 Like

No. You could constantly CFrame a placebo part to the Camera’s CFrame and then use that placebo part for functions such as Workspace::FindPartInRegion3, FindPartOnRay etc

Camera objects have a CFrame in global space, same as parts. Knowing this, you can do this by simply checking that the Camera.CFrame is within a Vector3 region, relative to the “waterpart”.

Check that the Camera’s position is >= the bottom left of the waterpart’s position, and <= the top right of the waterpart’s position. If both, then it’s within the waterpart’s region.

2 Likes