I’m using raycasts and i want to precisely raycast for a character’s mesh. Since I’m unable to change the collision fidelity of a character during runtime, the raycasts end up hitting the default hull-type collision box (Why can’t I change this bru) and the rain acts as though it’s on a flat surface, disallowing the rain to appear to glide on the surface. this seems to be fixed with custom rigs (rain works and looks AMAZING on custom rigs) but is there a way to do this with default characters?
Raycasts hit the collision geometry because that is literally what they are designed to do. If you want precision on a mesh, you would have to use something like WorldRoot:GetPartBoundsInRadius or manually check ray intersections against the mesh data, but doing that for every frame of rain is going to be expensive. There is no way to force a raycast to ignore the collision hull and hit the visual mesh instead without custom logic.
You are likely looking at a different implementation. They probably aren’t doing per-frame mesh intersection math for every single drop of rain, or they are using much simpler spatial queries that just happen to look good enough.
Changing MeshPart.CollisionFidelity at runtime is useless because it triggers a re-calculation of the collision geometry, which is heavy and won’t help if you are already stuck with the default character rig. The documentation links don’t address the performance cost or the fact that the mesh data isn’t even accessible for standard raycasts without custom math.
You can create a new mesh part using AssetService (theres an option to determine CollisionFidelity) for every Mesh content inside the character. It seems the game you provided as reference seems to do the same, because accessories are displayed using a SpecialMesh with no collision whatsoever, but this game has collision for accessories aswell, so I assume they get all MeshContent and create mesh parts with CollisionFidelity set to precise
So the only idea so far is to completely reconstruct the character but with collision fidelity set to precise? Bruh why can’t roblox just let me change it? That sounds wayyy too complicated accounting for multiple body types and sizes i might as well make a catalog avatar creator rip off at that point
If you are aiming for R15, its not very complicated, just get all MeshContent under body, create new mesh with PreciseConvexDecomposition and apply to the old mesh using ApplyMesh.
for _,Object in Character:GetDescendants() do
task.spawn(function()
if Object:IsA("MeshPart") and Object.MeshId ~= "" then
local MeshPart = AssetService:CreateMeshPartAsync(Object.MeshContent,{CollisionFidelity = Enum.CollisionFidelity.PreciseConvexDecomposition})
MeshPart.TextureID = Object.TextureID
Object:ApplyMesh(MeshPart)
end
end)
end
But for R6, the accessories use SpecialMesh, so it could be a bit different.
Sorry for the late reply - i tried it and it works amazing for r15! Although PreciseConvexDecomposition seems to be throwing error “Async physics data generation task failed” I just had to set it to Default instead.
Thank you!