- Home /
I need to be able to detect the mouse pointer entering a trigger area *through* an object that I'm dragging.
Hello,
I'm trying to figure out collision systems in Unity! I'm looking for a way to detect the mouse entering and exiting collision areas on a 2D game while dragging an object beneath the mouse pointer. I've experimented with using a Box Collider 2D and an Event Trigger, which works if I am not dragging an object. I, however, need to be able to "see through the dragged object".
I'm from a UE4 background, and I think I'd solve this in that engine by using ray tracing that follows the mouse position. I'd set up collision with a custom ray trace channel (e.g. UI), and set only the collision volume I need to respond to those traces.
Would this be the correct approach here, or am I missing something? Or is there a way to make stuff transparent to the built-in event system maybe? FYI, I'm using a button on my draggable object to start and stop dragging. I presume this is capturing my cursor and preventing it from touching the collision volume?
Additionally, I was not able to get OnMouseEnter() to work, I could only get results with an Event Trigger and the Pointer Enter event. Any ideas why this is?
Thanks, Mark
Your answer
Follow this Question
Related Questions
MouseOver different Objects C# 1 Answer
How do I detect when mouse passes over an object? 4 Answers
MouseOver issue with Collider on prefab 0 Answers
Find out if mouseposition is over gui-element or collider? 2 Answers
Mouse Over & Mouse Click 1 Answer