[Fixed] Voxel Meshes have weird collision for Raycasts

How do you cause this bug?

  • Create a Voxel Mesh. Stand on it and do world:Raycast() to the ground in a script. Usually, when you try to reflect a raycast, you can just rotate the direction after hitting the entity and shoot another raycast. On voxelmeshes however, the next ray will always hit the VoxelMesh itself again.

Which platform: PC

Your Crayta username: Vilva#9953

Game seen in (including “Hub” or “Editor for XYZ”): Editor

How regularly do you see this? (E.g. 2/3 times - please try 3 times if possible): Every time

Time + date seen: Oct 31 2021

Version number (found in Help tab in Settings): 0.d5.9.111485

Hi there Vilva,

Thank you for reporting this issue to us.
I have submitted a ticket to our internal team. :slight_smile:

Hi Vilva, thank you for your report!

After investigation, it appears that this is a technical limitation related to how we generate the collision data for voxel meshes. Because of this, any Raycast originating from the surface of the mesh will generate a hit on that surface.

The best I can offer is the following mitigation options:

  • Add the voxel mesh from your initial hit to your reflected raycast:
    GetWorld():Raycast(start, end, hitResult.entity, ...)
    This is quite limiting, as it prevents hitting some other part of the same voxel mesh, but depending on what you’re looking for, it might be sufficient.
  • Offset the start of your reflected Raycast by a tiny amount using the normal from your initial hit:
    GetWorld():Raycast(start + 0.001 * hitResult:GetNormal(), end, ...)
    This admitedly feels a bit hacky, but seems to work in all my test scenarios.

I hope this is helpful!

2 Likes

Hello

This bug has been resolved as of the latest update. Patch notes can be found here:Patch Notes: Cursed Galleons Launch!

Let us know if you believe the issue to still be present!