Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have two objects, both of them with polygon colliders. When I click on one of the objects, I want the player to drag it on top of the other object (without collision). If there is overlap when he drops the object, it snaps to the same position as the other object. Otherwise, it resets its position.

How do I: 1) make the colliders not prevent movement 2) make it so that it detects if they're overlapping when I let go 3) Make it snap to a very specific place depending on if they're overlapping or not

share|improve this question
    
Have you checked out any of the tutorials on Unity3d.com? This would help you get an understanding of all the topics you've mentioned. –  lase Jan 28 at 21:33

1 Answer 1

Without more details I can't be certain if this is an acceptable solution but you might instead take the approach of scrapping the colliders completely and simply comparing the distance between the 2 objects transform.position on drop.

Alternatively, you may be able to use the information from the bounding boxes (available via the renderers) to work with the Physics library's casting capabilities. I'd look into Physics2D.BoxCastAll

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.