[Solved] How do I set angle of pinned object

Get help using Construct 2

Post » Sat Dec 06, 2014 9:59 pm

Hi guys,

I feel this should be quite easy, but I'm not sure exactly how to start.
I have a button with DragDrop behavior, and I have an object pinned to this button. What I'm hoping to achieve is to have the object that is pinned rotate towards where I'm dragging the button. Not only the directions shown in the images attached, but a full 360 degrees. Does anyone know a simple way to fix this?

RotateDown.png

RotateRight.png

RotateUp.png
You do not have the required permissions to view the files attached to this post.
Last edited by oceldot on Fri Dec 12, 2014 11:34 am, edited 2 times in total.
B
14
S
3
Posts: 123
Reputation: 1,571

Post » Sat Dec 06, 2014 10:09 pm

First you need to check for 2 points in a time interval, for example, save the drag starting coordenates, then after some interval save the current drag coordinates and repeat this until the end of the drag.

You will always have 2 points, then use the angle(x1, y1, x2, y2) expression which returns the angle between 2 points, you will need to assign that angle to your object in every iteration while its dragging.
Image
B
15
S
4
G
4
Posts: 134
Reputation: 3,177

Post » Sat Dec 06, 2014 10:17 pm

That didn't really make much sense to me, I'm afraid. Any change you can create a simple capx to clarify?
B
14
S
3
Posts: 123
Reputation: 1,571

Post » Fri Dec 12, 2014 11:34 am

If anyone else for some reason want to achieve the same, you can do it simply by adding another object, and then pinning this to the object originally pinned. This way, the new object will rotate towards the first object, giving the illusion it's following your movement. And then all you need to do is hide the original object.

Confusing? Yes. Terribly written, I know. Sorry about that. Let me know if you need more details.
B
14
S
3
Posts: 123
Reputation: 1,571


Return to How do I....?

Who is online

Users browsing this forum: ultrafop and 28 guests