13
Is there any way to get ray intersections with meshes that don't have collisions?
(lemmy.blahaj.zone)
Welcome to the programming.dev Godot community!
This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.
Make sure to follow the Godot CoC while chatting
We have a matrix room that can be used for chatting with other members of the community here
We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent
It seems op wants to have areas that can't be reached not have colliders for performance, but still wants his bullets to be able to register hitting them for placing a decal on the collision.
Yeah this, although i should maybe clarify that the "bullet" is not a object/scene that has a position, i just perform one raycast to determine where it lands.
Also its not just about areas that cant be reached but very small "detail" things as well. Eg.: i might want to have bullet holes appear on the leaves of a plant but other than placing the hole on them the leaves don't need to interact with the bullet or the physics system in any way. So creating an area or physics body just for this purpose seems like overkill.
So for me what you want sounds either like magic or like nonsense.
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.
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.
maybe XD.
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.
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)
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.