- Home /
Fixed it
Box colliders getting Stuck
Hi,
I am instantiating three to four objects at a particular position and applying upward force. Problem here is that colliders are getting stuck in each other which I don't want. Any suggestion on this would be great.
Answer by taxvi · Dec 23, 2014 at 10:57 AM
good way to approach this is to first set the colliders as triggers, this will disable all the physics interaction of the colliders but they will still detect which other colliders enter/exit them. then create an integer variable that will count the number calls of OnTriggerEnter and OnTriggerExit. good thing is that OnTriggerEnter and OnTriggerExit are called once for each intruding object and can be called several times during a single FixedUpdate. This will ensure that you will count your interactions correctly. then take your integer variable and increment it in OnTriggerEnter and decrement in OnTriggerExit. once you have the same number of exits as enters (int variable is 0) you can convert your colliders to non-triggers.
Follow this Question
Related Questions
Why is my object getting stuck in the edge of other objects? 2 Answers
How to make objects collide and move each other? 2 Answers
basic cylinder with capsule collider 1 Answer
I can't get ANY simple collision to work! 3 Answers
Why is my character not sticking to platform? (Script included) 1 Answer