Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Neverdyne on January 16, 2014, 05:23:27 PM
-
Hello there, I'm making a scene where the player can drag a few sprites around, however I need to know if the sprites hit a trigger collider while being dragged. This only works when the player releases the dragged item and the item returns to it's original parent, passing through the collider on its way back, but it doesn't work when the player is dragging the item. I believe this is because when you drag an item the box collider in it is disabled, so the trigger collider can't detect a collision. Does anyone know a good and efficient way to detect collisions between static triggers and the dragged item, or at least provide the same functionality in a different way?
-
Easiest and fastest way is to do your own math. Simple 2D rectangle intersection test would do it.
-
Thanks for the reply! What I ended up doing was making my draggable item have a child transform with a collider of its own, seems to work so far.