Make a draggable sphere bound to a transparent quad's boundaries
I have objects with a sphere collider that the user can drag using this script:
public bool Enabled = false;
void OnMouseDrag()
{
if(Enabled)
transform.position = Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 61.5f));
}
I have a quad with an image as a background map. The image has transparency. I want the user to be able to drag the object over the non-transparent part of the map only.
The screenshot shows a sphere and a quad with a map with transparent edges.
I think the current configuration wouldn't enable me to do what I need. How should I modify things? The script? The map? The draggable object?
Your answer
Follow this Question
Related Questions
Cannot call trigger-event when dragging object via touch 1 Answer
OnDrag is moving all colliders on Touch? (Not on Standalone) 0 Answers
Colliders detect collision too late - touch dragging problem 1 Answer
How to make visible colliders of a 3d object in game? 1 Answer
unity text ui collider boundary(margin) 0 Answers