i am making a script that checks if your camera is in the water part. I already have made the effect and got it working, but i cant find a way to check if the camera is in the water part.
You could use (WaterPart.Position - Camera.Position).Magnitude
2 Likes
What shape is your water part? If it’s a simple cube/cuboid you can use the following.
local function IsInstanceInOther(Instance1, Instance2)
return Instance1.CFrame.X > Instance2.CFrame.X - Instance2.Size.X / 2 and Instance1.CFrame.X < Instance2.CFrame.X + Instance2.Size.X / 2 and Instance1.CFrame.Y > Instance2.CFrame.Y - Instance2.Size.Y / 2 and Instance1.CFrame.Y < Instance2.CFrame.Y + Instance2.Size.Y / 2 and Instance1.CFrame.Z > Instance2.CFrame.Z - Instance2.Size.Z / 2 and Instance1.CFrame.Z < Instance2.CFrame.Z + Instance2.Size.Z
end
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.