Make polygon shapes to snap automatically
-
- Posts: 2
- Joined: Tue Feb 23, 2010 12:11 am
- Contact:
Make polygon shapes to snap automatically
I want to make 2 polygon shapes to snap together automatically when they are very close. To "snap", I mean one or two vertexes of one shape stick to those of another. I did some investigation but haven't come out with the idea. Can anyone comment?
- Tam Toucan
- Posts: 141
- Joined: Tue Jun 23, 2009 4:26 pm
- Contact:
Re: Make polygon shapes to snap automatically
Need a bit more context since there are a million ways to approach this. e.g. have sensors at the points you want to snap together and when the collision is detected create a constraint to pull them together. Or create a sensor around the entire shape, when a collision is detected calc the distance between each of the points yourself and work out how to move the two shapes together. Or create a new polygon which is a combination of the two.
-
- Posts: 2
- Joined: Tue Feb 23, 2010 12:11 am
- Contact:
Re: Make polygon shapes to snap automatically
Tam, thanks a lot for letting me know the existence of sensors I figured it out by adding sensor shapes around every vertex, and adding/removing constraints in conflict begin/separate handlers. It works nicely.Tam Toucan wrote:Need a bit more context since there are a million ways to approach this. e.g. have sensors at the points you want to snap together and when the collision is detected create a constraint to pull them together. Or create a sensor around the entire shape, when a collision is detected calc the distance between each of the points yourself and work out how to move the two shapes together. Or create a new polygon which is a combination of the two.
Who is online
Users browsing this forum: No registered users and 22 guests