FindPartOnRay does not compensate for GetRenderCFrame on the client

Raycasting on the client does not acknowledge that parts may not actually be getting rendered where their CFrame is, and therefore the result isn’t accurate.

This is a problem, because the Camera’s PopperCam module uses raycasting to figure out if it needs to be pushed forward or not, and as @Shedletsky was able to reproduce, this may cause it to jitter when in a moving car that you don’t have network ownership over, if there is something that the PopperCam can hit behind your head.

I made a place that demonstrates this problem in action:

The yellow dot represents the origin of the raycast that I’m doing.
The green line represents the raycast itself.
The red dot represents what result I’m getting from FindPartOnRay.

It should be landing directly on the surface of the torso, but instead its acting very jittery.

(Note, the adornee used for the wireframe visualization of the torso’s CFrame is not parented to the workspace, so thats not what the raycast is hitting)

2 Likes

FindPartOnRay must not be changed, as it will then mess up physics and scripting related uses if it doesnt return where the part is in the actual simulation.

While a render-aware alternative would probably solve it, I feel like the data structure(s) FindPartOnRay relies on doesnt know about the render position of stuff. So theyd need to duplicate the whole data structure, doesnt seem worth it.

Best course of action seems like just updating the camera code to work around.

2 Likes

Raycasting doesn’t consider rendering. It only considers physics bodies, which is also why collisions with unions and meshes will land on the physics hulls instead of the mesh geometry.

Sounds like your problem could be fixed with a better ignore list.

It’s an issue with the core camera scripts, so it’s not exactly his problem

1 Like

Or you can just turn CanCollide off on some of the parts of the car…

Raycasting isn’t affected by CanCollide

No but the poppercam will go through non-CanCollide parts (talking about video in OP)

Also if you set the cam offset of the Humanoid to be above the car that would also fix the problem in this instance I think?