Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6865971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:07:20+00:00 2026-05-27T03:07:20+00:00

In the touchesMoved method, what is the math to have an object on the

  • 0

In the touchesMoved method, what is the math to have an object on the screen move along a dragging touch vector? For instance, if I touch beneath my object (Y > object.y), and drag “up”, I want the object to move from its current x,y location along the same vector that my finger moves.

Currently I have it working that the drag motion snaps my object to my finger’s location, but sometimes my finger hits the edge of the screen before I get my object positioned correctly.

If I know my “touch down location” and the “current touch location” what is the math to determine where to move object.position?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:07:20+00:00Added an answer on May 27, 2026 at 3:07 am

    I hope that you have already received the answer of figured it out yourself, but.

    Assume that your object’s Upper Left Corner (ULC) is at Object.X, ObjectY.
    Assume that the CGPoint returned by touchsBegan is Touch.X, Touch.Y.

    The offset (Delta) will be:

    • Delta.X = Touch.X - Object.X
    • Delta.Y = Touch.Y - Object.X

    Subtract these from each point returned by touchesMoved and your ULC should move as you expect rather than snapping to your finger.

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have two fingers touching iPhone's screen but just one is moving. TouchesMoved
I want to make a drag and drop action in iPhone: when I touch
I have a method such as this: -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ //Use to animate
I move a UIImageView with touchesBegan , touchesMoved , touchesEnded . It works well,
I want to change my view size using user touch input. What I know
For example, the method: - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event in UIResponder has an NSSet*
i want store my touchesMoved value in to NSArray how can i store that.
I have a subclass of UIScrollView that overrides touchesBegan:withEvent: touchesMoved:withEvent: touchesEnded:withEvent: Overriding these three
I want to let user draw a signature on iPhone screen, so I add
I have a ViewController that responds to some touchEvents (touchesBegan, touchesMoved, etc...). I've found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.