Roblox Camera Collision Question

So I have a gun system in 3rd person, right now I am facing a issue, Camera wich bug on Parts due collision.

So my question is does anyone know how Roblox manage default camera making for example Walls, roof and others part like this collidable?

And minimal part always with collision and character of others user are not?

If so does anyone might know how I can integrate this logic in my code maybe exporting function or something like this.

Thank you

1 Like

hello there!
Sounds like you need a bit of Collision Groups

(this link leads to the documentation about collision groups, and how some groups can collide with others, but some can’t)

Camera is not a base part and in this function you can add only base part.
If I am wrong can you realize a very fast example?

before i do so, you want to exclude the camera from any collisions right?
(that’s what you want right?)
(or you want to have the camera only touch certain things?)
if it is the latter you can actually create a part, add it to a collision group, then make a script so the camera is bound to that part, therefore the camera will collide with the same things as the part.
I haven’t tested it but to bind the camera to a part:

--local script
local runService = game:GetService("RunService");
local part : --your part

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable;
runService.HeartBeat:Connect(function(delta)
  workspace.CurrentCamera.CFrame = part.CFrame;
end)

Not yet I want my custom camera to make it similar to the classic Roblox camera, so I was wondering how Roblox exclude some part and include some others

Example: roof and wall on Roblox are camera collidable

Semi transparent part, character, small part small are not camera collidable
how they do that?

well i don’t know either…
They are probably using their own api (example of roblox using their own hidden tools are timerservice and debris), but we get to use collisiongroups to kinda replicate it.
You’d have to handle camera movement yourself but…

You could try looking for the code and changing it by copying the script from PlayerScripts when you start the game