How should I go about having objects in different "dimensions" #930
-
I have the possibility for entities/cameras to be assigned dimensions in my engine. What is the recommended way to handle something like this in Jolt since I would only want objects in the same dimension to collide with each other? There are two methods I can think of, but i'm not sure if either of these are good/bad. Method 1: Have some bits reserved in the layer for the dimension that layer is intended for and change the ShouldCollide implementations to compare the bitmask for the dimension. I wonder though if it will be a problem having a potentially large number of layers for performance? Method 2: Each layer has its own physics system - The downside here seems like it would be memory usage. Please let me know your thoughts on what the approach should be. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think both methods are valid solutions and I can't really predict if one of them will be better than the other. If you pick method 1 and objects in different dimensions can never collide with each other then it is smart to give each dimension at least 2 broad phase trees (BroadPhaseLayer): 1 for static and 1 for dynamic. This minimizes the amount of work that the collision detection system needs to do as it can trivially disregard all other dimensions (since they're in different trees). |
Beta Was this translation helpful? Give feedback.
I think both methods are valid solutions and I can't really predict if one of them will be better than the other. If you pick method 1 and objects in different dimensions can never collide with each other then it is smart to give each dimension at least 2 broad phase trees (BroadPhaseLayer): 1 for static and 1 for dynamic. This minimizes the amount of work that the collision detection system needs to do as it can trivially disregard all other dimensions (since they're in different trees).