Quantcast
Channel: Latest Questions by Christop
Viewing all articles
Browse latest Browse all 16

MeshCollider does not produce OnTriggerExit messages

$
0
0
Hi I have a gameobject which has a meshcolider and a rigidbody(kinematic) to move around. I initially create (by instancing) this object inside a trigger (box), and would like to detect when the gameobject exits this box. The object is controlled by keyboard. Initially all this was working, but when I assigned a script to the gameobject which starts a Coroutine on Start(), which scales (using localscale) the size of the object depending on the distance from its point of creation. So the gameobject starts at localScale 0.1 and is scaled to localScale 1 after it has been moved by a certain amount. As soon as I added the coroutine script I stopped getting OnTriggerExit messages and the OnTriggerEnter messages were emited each frame instead of only once. This behaviour is exhibited for as long as the coroutine (which adjusts as I said before the localScale) is running. If the coroutine exits (using a test debug flag) all is normal again. This looks like a Unity Bug, does anyone have similar experience or a way around that> Using primitive colliders (box etc) the code works, but the mesh is quite complicated this is why I preferred mesh colliders. Thanks

Viewing all articles
Browse latest Browse all 16

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>