Touch & Rotation

0 favourites
  • 5 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Is there a way I can get an object to rotate in the direction of where I touch?

    So if I touch on the right of an iPad screen, the object will look right.

    I already have the simulated 8-directional movement attached, but the object/player should also rotate in the same direction of its movement.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To look make an object look at where you touch, make sure you have both the object and the Touch object ready.

    You then create the event on the event sheet "On Touch Start", which is found under Touch. You then add the action "Set angle toward position", found under the object you wish to rotate. It will then ask you for the X and Y coordinates for the position. In X put "Touch.X" and in Y type "Touch.Y". That should work!

    This will only have the object face your Touch once. If you want it to continually turn to your touch, make the event "Is in Touch" instead.

    (Just a quick tip, which I didn't learn until a few days trying, you can set the Touch object to treat Mouse clicks as Touch taps. This is in the properties tab for Touch. This way you can test the program on the computer instead of having to transfer it over all the time!)

  • wow. Thanks so much. I have changed the setting to now use mouse input.

    I have been using a brilliant plugin called TouchMouse, which works great. But in this instance, its not suited.

    Thanx Again

  • I'm also finding a way to implement this, would you be kind enough to supply us with a .CAPX sample demonstrating this touch rotation. Thank you in advanced...

  • Try:

    is in touch

    set angle to anglelerp(self.angle,angle(self.x,self.y,touch.x,touch.y),1-0.5^dt)

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