Hey there, I’m trying to find a way to get an accurate hit detection while having a physics “Min penetration for penalty” of 0.05. The thing is; when I use OnCollisionEnter, it will react to early and if I try to use On CollisionStay, it will usually react several times.
If anyone have any solutions to this it would be much appreciated.
Depending on the shape of your gameobjects, you could use a raycast of sorts, to see if there is anything in range.
I’m not entirely sure how something can collide too early if you’re using “OnCollisionEnter” as that only gets called when you collide with something, and not when you’re in the proximity of something.
Alternately you can make a bool that allows you to run that line of code whenever its true. so at the “break” you set the said bool to false, meaning that you will only be able to run those lines of code once before having to reset the boolean.
Also; if your min penetration value gets too small the objects wont stay still, instead it will cause the physics engine to go into overdrive and have the object bounce all over the place.
If you could elaborate a bit more on what you want your script to do, and what objects you have, then people might be able to provide additional assistance