[Solved] How do I set angle of pinned object

0 favourites
  • 4 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • 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?

    [attachment=2:3l4xjndt][/attachment:3l4xjndt]

    [attachment=1:3l4xjndt][/attachment:3l4xjndt]

    [attachment=0:3l4xjndt][/attachment:3l4xjndt]

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That didn't really make much sense to me, I'm afraid. Any change you can create a simple capx to clarify?

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)