Changing camera collision for some objects

If I want the player camera to not collide with some objects, such as collidable debris, do i need to copy entire PlayerModule to modify the camera collision part? Or is there another way to do it?
Like these

1 Like

Boldly assuming the camera module performs a raycast using the “Default” CollisionGroup which is applied to every BasePart by default, you should be able to register a new CollisionGroup (e.g. “Debris”) and set the CollisionGroup property of your debris to “Debris”.

Since the camera raycast is strictly performed on the “Default” group, it wouldn’t include your “Debris” instances.

2 Likes

let me implement and check :+1:

so for first usage, which is anchored objects colliding with characters (players collision group), not colliding with default group, it worked great, thank you!

second usage is not anchored objects which means they need to collide with both default collision group and player collision group, so they also do not fall
didnt work, if the collision group can collide with default group, it seems to not work

Does that mean you have multiple collision groups that the camera should not collide with?
In that case, unfortunately collision groups won’t cut it for you.

You’ll definitely need to modify the existing camera module to exclude specific instances, which you’ll have to tag beforehand, and later in the camera module, retrieve with CollectionService.

1 Like

no no, the issue is if parts dont collide with default group, non-anchored parts will fall below the map, so while you can make it work with anchored parts with creating a group that doesnt collide with default, i guess you need to modify player module, to make camera not collidable with non-anchored parts
(my goal was creating parts that collide with characters but not with camera basically)

anyways thank for the help and idea, first usage is also useful for me

You don’t have to make your “Debris” and “Default” groups not collide with one another – the camera raycast specifies which group to check collision for and only that group, which defaults to “Default”.
So by simply assigning a different group to your parts, the camera should be able to phase through parts of that different group.

If I’m yet again misunderstanding, feel free to ignore my rambles.

so i tried with LOCALPLAYER2 group, the camera still does not passthrough, but it does passthrough LOCALPLAYER. Are you sure? Because it does collide with LOCALPLAYER2 on my end. I think its not just default, but whatever can collide with default.

I took a peek at the default camera modules and noticed some interesting FFlag conditionals that may be interfering here.

Could you do the following (just temporarily to test)?

  1. Start a Server & Clients playtest
  2. Navigate to StarterPlayerScripts on the client window.
  3. Copy the PlayerModule.
  4. Paste it into your main studio’s StarterPlayerScripts.
  5. Open PlayerModule.CameraModule.ZoomController.Popper.
  6. CTRL+F to search for FFlagUserRaycastUpdateAPI within the module.
  7. Inside every false condition where it checks against this flag, place a print (can print anything).
  8. Run another playtest, collide your camera with the parts, and check if it prints anything.
    • If there’s prints, it means it’s opting for a deprecated raycast method that doesn’t support collision groups. Your safest bet here would be to customize the camera module, as FFlags can differ for every player.
    • If there’s NO prints… We’ll have to continue debugging lol.

PS: It’s late here, so another response from me may take a while.

image
if you use default group, it wont just collide with default group but any group that collides with default, if you want it to only collide with Default you need to use something like this operation for raycast

removeCollisions("COLLISION_OPERATION_PARTS") --set collision to false for every group
PS:CollisionGroupSetCollidable("COLLISION_OPERATION_PARTS", "Default", true)

i have FFlagUserRaycastUpdateAPI enabled and it sets that hardLimit variable

it seems the module just does raycast checks, does not give any head (maybe a property or tag/attribute) or config etc. to devs, to control the behaviour
i can copy this module and fix the issue but i dont know if roblox updates it all the time, which can create issues for future about compability to new devices or to new systems etc.

This was what i needed mainly and it worked, thanks. I will just wait for them to change it, if they do (which prob not). Its just not that big of an issue to copy player module entirely for a small QOL change

1 Like

i can copy this module and fix the issue but i dont know if roblox updates it all the time, which can create issues for future about compability to new devices or to new systems etc.

You’ll be fine.
I know of games I had worked on that used legacy player modules for at least half a decade and managed just fine.
At worst, you’ll have to update the module whenever there’s deprecations (e.g. to replace the deprecated raycast calls with the newer one).

if you use default group, it wont just collide with default group but any group that collides with default

I still think this is very strange because this is not how the feature is advertised, but at least you found a workaround. Goodluck!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.