So far (outside of somehow adding it into Godot via C++ myself) this doesn’t seem possible but wanted to ask to see if i maybe missed something.

The most i could find was this issue and a couple of related ones.

My specific use case would be for drawing bullet holes onto meshes (via decals). Ideally also being able to determine the texture used on the faces of the meshes that are intersected (to determine an appropriate decal to use).

Having everything that is possible to hit duplicated as a static body or area seems excessive to me. Since the only data required for ray intersection should be the transform of the meshes faces/edges/vertices etc which i would think are already contained in the mesh itself?

Failing being able to make intersecting a ray with meshes work i will probably try experimenting with using areas. They seem the lowest performance cost out of all the options the existing ray cast can detect. I would still end up with most of the games geometry being duplicated though, once as actual meshes and once as collisions for all the areas.

  • Ti_KaOP
    link
    fedilink
    English
    21 year ago

    So for me what you want sounds either like magic or like nonsense.

    maybe XD.

    Ray casting is part of physics processing and therefore need a physics body. Using physics body actually should reduce performance impact since you can reduce the geometry of those making calculation less extensive as when you use the full Mesh geometry with al the details.

    Yeah i know, but my problem (was) that almost all meshes visible to the player would need a collision to properly place decals on. And additionally, for the decals to look right, they need to be placed close to the mesh, so i need the collision shape to match the mesh very closely. Which doesn’t allow me to simplify the collision a whole lot.

    So effectively i have to duplicate most meshes in the scene as collision objects while barely or not being able to simplify the collision compared to the mesh. Also most of those collision objects would have no use besides being intersected by a handful of rays per second to place decals since. While most meshes that are visible to the player need bullet holes on them when hit. Most also don’t need to interact with the bullet/shooting in any way besides that.

    My fear was that Areas or StaticBodies cant be optimized well for something like this where i have large quantities of them with complex shapes that are rarely used. Ideally i would still have a way to directly intersect the visual meshes but i can see how that might be performance intensive to do even if built into the engine so it makes sense it doesn’t exist.

    So for me just creating an auto generated physics body for ray pickability or using the actual mesh geometry sounds like the same thing. But maybe I’m missing something here.

    You aren’t really missing anything. I’m attempting that solution now since it seems like the only feasible one and i’m just crossing my fingers and hoping that my fears about Godot not being able to handle that many areas without performance issues was unfounded. (Although in the current state of the scenes i have i suspect it is going to be fine either way. I’m just worried it might not scale well if i eventually use larger quantities of more complex meshes)

    • FeyterM
      link
      fedilink
      English
      11 year ago

      To much is always to much.

      My advice would be to implement it first and try to optimize if you need to. I think disabling object outside of a range what the player can currently interact with would probably be a good start to save performance.