|
|
|
|
Reply From: |
MallNinjaMax |
I believe the Area node is what you’re looking for:
To prevent it from interacting with any other collision objects, set it to a different collision layer from anything else it shouldn’t be interacting with. Areas currently don’t work with concave trimesh statics, but it sounds like you’re just going to be using other areas with the built-in primitive shapes. In which case, you’re good to go.
Use get_overlapping_areas()
or get_overlapping_bodies()
to return an array of the nodes overlapping it. Otherwise, use overlaps_area(Node area)
or overlaps_body(Node body)
to check for a specific collision.
The performance cost of what you’re trying to do sounds negligible. Trying to do this in any more custom way is, as you put it, “fly swatting with a sledgehammer”. It’s probably not worth your time. I am curious why you think using something like this is complex to set up. It seems like you might be overthinking this a bit, but I don’t know the context of your use case.
I specifically meant the custom Physics setup with an own physics space, bodies, etc. at runtime with “more complex than necessary”.
Sure it isn’t that complex compared to other things, but if all you want is to answer a simple “does this collide with that” question unrelated to any visible scene, any kind of elaborate setup to achieve that seems too complex.
Areas could be what I’m looking for, but I’m worried about this part:
For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved.
Now, I’m not planning to move anything around, but this could be interpreted as requiring a frame after something was added to even function. But what I’m planning is to add a number of those proxy objects (potentially a very large number, think dozens/hundreds) - I can’t allow the engine to run for a frame after each of those adds before checking for collisions. It all has to work immediately. As I said, I actually just need the maths here, not really any kind of engine/scene/node functionality.
Also, there is no overthinking when performance is crucial (and it is very much in this context, unfortunately). “Optimizing performance later” is a mantra that lead to all those horribly perfoming games that have been released lately, because clearly somebody was not thinking about performance when implementing something, but that’s really getting off topic…
TheSHEEEP | 2019-07-12 07:24
That “frame” is a physics tick. It’s set to match a standard frame rate of 60/sec by default, but is independent of framerate. You can increase it in the project settings if you need more precision.
But, you’re being extremely cryptic about what you’re trying to do for some reason. To the point where it’s hard to recommend anything. You’re now firmly in the “XY Problem” zone.
Please tell us what you’re trying to do in a broader sense (how would a player describe this feature?), and tell us what you’ve tried.
“Optimizing performance later” is a mantra that lead to all those horribly performing games that have been released lately, because clearly somebody was not thinking about performance when implementing something
Off topic? Maybe. It does tell me that you know a lot less about game development than you think.
MallNinjaMax | 2019-07-13 00:27
That “frame” is a physics tick. It’s set to match a standard frame rate of 60/sec by default, but is independent of framerate. You can increase it in the project settings if you need more precision.
So in other words, some time would need to pass after I add an area before I could check if another added area collides with it? Even if I lowered the rate to a single millisecond, that would mean a delay of half a second for 500 of those proxies and that’s not even including the time needed for the actual check.
That’s not acceptable for my use case, so I don’t think Area is what I’m looking for.
I was going to try my hand at a GDNative module at some point anyway, so why not implement libccd if it adds some functionality I need… might be fun.
But, you’re being extremely cryptic about what you’re trying to do for some reason. To the point where it’s hard to recommend anything. You’re now firmly in the “XY Problem” zone.
You know nothing about the bigger problem I’m trying to solve, and somehow that leads you to assume I must be trying to tackle it wrongly, simply because your suggested solution won’t work? I have spent months planning through many aspects of my project and broke this particular one down to the point where I could ask a specific question as I don’t know the engine well enough, yet.
Though I agree I should have added that I need to do a large number of these calculations in an as-quick-as-possible manner, which is why I do not want to wait for any kind of tick/frame after each and every add. I’ll add that to the question.
Rest assured, this is not an XY Problem situation. I’m not trying to do premature optimization here, this simply is an extremely performance sensitive part of the project and every millisecond saved will help.
But really, if you believe me or not is none of my concern, I’m not here to debate approaches or seek approval.
This is also not a discussion forum and I was wrong in making that off-topic remark which got you triggered. We seem to disagree on how to properly develop high-quality software, but this isn’t the place for that discussion.
TheSHEEEP | 2019-07-13 07:44