- Home /
Collision detection with pooled objects
I have a lot of objects that have colliders on them, and don't move, except when pooled. They are not affected by physics. How should the setup be like? My player has a rigidbody, and a collider. All other items should be just colliders? Than I would get problems from moving them around as I pool and reuse them. How is this usually done?
To simplifiy the question:
I do now use physics to move objects. Everything is animated, or moved via transform.
Object A:
is pooled
does not move any other way (eg: wall)
should collide with player
has hundreds of instances
has box collider
Object B:
the player
should collide with object A-s
has box collider
has rigidbody
Is this setup correct? When I reuse object A, and move it to a new position, that is bad for performance as far as I know.
To get any reasonable answer you must provide clear and complete description of this situation and given problem.
What's the question?
Generally, object pools are just mechanisms to recycle objects; when everything is set up correctly, the fact those objects are pooled is only important when creating/destroying them.
So, pools shouldn't affect colliders, and colliders shouldn't affect pools. If they do, something is possibly going wrong. Perhaps there are objects or components that should be disabled some of the time (for example, disabling colliders while they shouldn't be colliding).
If there's a specific problem, here, I'm not seeing it.
I get huge spikes in performance when I move around the pooled objects. That's my problem.