Collision shapes performance question

Hi there,

I have a very large architectural model with a correspondingly large amount of collision shapes.
The rooms are split-level and I wonder how to best deal with the shapes.
Here is a quick mockup of what I mean, the green cubes represent the shapes.


Which solution would be preferable?
Also: let’s say I have 12 shapes. If I organized them eg. using 3 game objects with one collision object each (carrying 4 shapes) or using one game object with one collision object that carries all 12 shapes - would there be any difference if it comes to performance?

There will be no noticeable difference.

2 Likes

Thank you very much @britzl, that’s good to know and I will organize the shapes in nice and clear layout.
This leaves me with the question how to deal with shared walls of my split-level model - again with an eye on performance:
what matters more: the size of a collision object or the amount? In the above example, the large shape covers an area of about 40x12 meters, leaving areas that wouldn’t really need covering (but meaning far less work for me :grinning:), the smaller ones fit the rooms exactly.

In terms of what?
It depends on what you value most.

The smaller number of objects, the better of course, but you also need to think about the size of the objects as the precision of the physics calculations isn’t infinite.

The physics uses 32-bit floating point precision, so you have to take that into account, both in terms of size of the objects, and also their location (i.e. if their distance from origin is large).

We also have the setting physics.scale in order to translate to an acceptable range for the physics objects.

I’d say a 40 meter large object is large-ish, but might not be an issue.

But, what is acceptable to you is only something that you can decide, and you need to decide what is acceptable in terms of performance.
And with performance I mean both the number of milliseconds it takes, but also the accuracy of the physics objects.

And, to determine what it acceptable, the only way to do it is to make tests for yourself.
It also ties back to your first question, which could have been answered if you had made a test for yourself.

To sum up, I’d say your setup is probably ok, but it’s always best to test for yourself!

2 Likes

You are quite right - I’ll do that. But you know, I’d have a lot, and I mean a lot of these shapes (25 rooms, 50 doors, stairs etc), so I thought, maybe the devs know what would be best.

This very useful info, thank you very much!

1 Like

It was brought to my attention that my post was overly brusque.
I can only apologize for that, it wasn’t my intention, and I’ll try to clarify some more.

My main point was to encourage our users to test their own scenarios out.
We engine developers know the engine to a large extent, but not 100% in all aspects, at all times.
For instance, we cannot always predict what issues might pop up when the game developers produce their games.

As such, to get a full answer to the question “will this work in my game?”, you would either have to rely on prior
examples (e.g. from other games) or other users expertise (e.g. asking us on the forum), or testing out the scenario by yourself.
If you’re doing anything slightly out of the ordinary, I would encourage you to make some tests on your own to verify the expected behavior.

And, of course we welcome questions to us, I’m sorry if my answer suggested otherwise.

2 Likes

Hi there,

Don’t worry, I know you didn’t mean to offend, I just wanted to explain my take to you.
Of course you are right, testing before asking is preferable. But you have seen the vastness of the model. From my perspective it was only logical to ask here what best to do before starting to place the shapes into the model which will take ages.
I as well want to apologize to you and I thank you very much for your reply.

Happy Easter

Brigitte

2 Likes