Curved swipe motions

mill4023mill4023 Member Posts: 9
edited July 2012 in Working with GS (Mac)
I've got a game that involves swiping a ball to make it move in whatever direction you swipe.
I have an actor that covers the whole scene and it has a rule that fires when touch is pressed, recording the x and y position where the touch started. The ball actor has a rule that says when the mouse is over the object, move it in the direction of the swipe. I'm using vectorToAngle with the position where the touch started and the position of the ball.
This seems to work fine for straight swipes. The problem is with curved swipes. The ball moves in the direction of a straight line from the starting touch position to the ball, but that doesn't always match the direction the swipe was going when it hit the ball.
Imagine you touched the screen directly to the right of the ball, then moved your finger down below the ball, then up towards the ball. With my technique, the ball is going to move left, even though intuitively, it should move up. Make sense?

Any better strategies for handling this?

Is there any way to determine what direction a swipe was going right before it hit the ball instead of just using the start and end point?

Answers

  • fadamionfadamion Member, PRO Posts: 309
    edited July 2012
    Well i doubt this would be the right way to do it but you might check to see if you like the results. Make an invisible actor have it do the swiping then use its motion and what not to control the other actor. Make sense? Also try all types of move like constrain, interpolate and move to see what you get.
Sign In or Register to comment.