- Home /
low impact alternitve to onTriggerEnter
Hey hey,
So I have hit a roadblock with a project , I want lots of objects to be able to know when they are touching each other, onTriggerEnter could do this but it requires a ridgedbody witch can be a tad lagy one you get to many,is there a better way to do this?
all code in c# please,
thanks in advance.
Answer by JedBeryll · Feb 28, 2018 at 05:23 PM
Objects that move and have colliders should always have a rigidbody or they will be even slower. Implementing something that works similarly would probably not worth the time and they would probably be less efficient. You can set up a collision matrix and only have those objects collide with each other so they are never checked against other layers. You could disable objects that are far away from everything else if that's possible in your game. Try to minimize the objects count that needs to be checked every physics update.
That's not a bad idea,but some things that will be intersecting just should not have a rigidbody, rain zones and fire for example, they would both be ok with moving things like the player but one would need a rigidbody if rain is to extinguish fire, there are work arounds in that scenario but others might not be so simple to get around.
That's right, but i can't give you better tips because those would depend on your game a lot. You'll have to be resourceful i guess.
Thanks for taking the time to try good sir.
Your answer
Follow this Question
Related Questions
Can't get trigger to work 1 Answer
Point of contact on other object in OnTriggerEnter 1 Answer
Trigger not reaction to code, even tho there is collision detection 2 Answers
Moving Trigger/Platform and Moving Player calls OnTriggerEnter every frame 0 Answers
OnTriggerEnter not being called, have trigger, RB, and colliders set? 1 Answer