"Snap to" an overlapped object

Get help using Construct 2

Post » Fri Mar 01, 2013 5:31 pm

Hiya

I have a circle and a line.

When the circle is near the line I want it to snap to the line.

I've tried to do this by making the circle a bigger circle, which means the overlap occurs sooner.

That bit works.

I can't figure out how to centre the circle over the line, or rather the point on the line where the overlap occurred, thus making a "snap" effect.

Heylp!
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Fri Mar 01, 2013 7:09 pm

If you want it to snap to certain points along the line why dont you make image points on the line. Then you can easily get the nearest one...
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

Post » Fri Mar 01, 2013 7:26 pm

The lines are drawn dynamically at any width, anywhere :)
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Fri Mar 01, 2013 7:41 pm

Sry thought you are talking about sprites
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

Post » Fri Mar 01, 2013 7:57 pm

Have you tried looping the circle towards the line until they intersect, and then backing up one step?

Perhaps you could upload a simple capx to illustrate the issue?cincipon2013-03-01 19:57:37
B
6
S
1
G
1
Posts: 70
Reputation: 702

Post » Fri Mar 01, 2013 9:08 pm

I'm not sure I quite understand what you want to do, but try the pin behavior.
B
40
S
12
G
7
Posts: 603
Reputation: 7,646

Post » Sat Mar 02, 2013 10:29 am

What I was trying to do, especially for touch, is work out what's near my pointer rather than having to be pixel-perfect aligned with my pointer. And if I am near, have all dependant events behave exactly as if I were dead on top of the object.

It's ok though, done things a totally different way instead. :)
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Sat Mar 02, 2013 5:37 pm

https://docs.google.com/file/d/0B-6JjcHcczubZGc1RGtDbF9Dbnc/edit?usp=sharing

@silkc2 Perhaps something like that? Though I am using the mouse object, It should work just fine if you swap out that with touch.
B
6
S
1
G
1
Posts: 70
Reputation: 702


Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, tarek2 and 22 guests