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

  • Home
  • SEARCH
  • 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 188551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:05:19+00:00 2026-05-11T16:05:19+00:00

I am trying to solve a tricky math problem, in a cocos2d for iphone

  • 0

I am trying to solve a tricky math problem, in a cocos2d for iphone context.

Basically I have a roullette wheel which is rotating over time.

I want to have a Sprite latch onto the wheel at certain points (like compass ordinal points N, S, E, W) and bounce off at all other points.

I have the image of the wheel rotating, and just need to solve the part where I can test for whether a sprite has intersected with the circle at the right point on the circle as it is rotating.

I think this question is going in the right direction, but I can’t get my head around it. Can anyone help explain?

Best way to find a point on a circle closest to a given point

  • 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-11T16:05:20+00:00Added an answer on May 11, 2026 at 4:05 pm

    If I understand correctly:

    First check the distance between the sprite and the centre of the roulette wheel. This will tell you if the sprite is at the edge of the wheel. (If not, nothing happens, right?)

    Then, find the angle that the sprite makes from the “x-axis” of the roulette wheel.

    spriteAngle = atan2(sprite.x - rouletteCentre.x, sprite.y - rouletteCentre.y)
    

    You’ll need to find the equivalent of the atan2() function. It usually returns an answer in radians; you may want to convert it to degrees or quarter-turns or something if you prefer.

    Then, subtract the angle that the roulette wheel itself is rotated by (if the wheel itself is rotating, if not then you’re already done). Make sure your angle measurement is consistent.

    actualAngle = spriteAngle - rouletteRotationAngle
    

    Note that actualAngle may be outside the range 0-360 degrees, and you will need to make it “wrap around”.

    Lastly, you will want to allow a small range of values as acceptable (e.g. 98 degrees to 102 might count as “North”).

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

Sidebar

Ask A Question

Stats

  • Questions 190k
  • Answers 190k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is to be expected IMO. After all, consider the… May 12, 2026 at 5:54 pm
  • Editorial Team
    Editorial Team added an answer My first thought was that your log4j XML or properties… May 12, 2026 at 5:54 pm
  • Editorial Team
    Editorial Team added an answer What you're describing is often called behavior verification (as opposed… May 12, 2026 at 5:54 pm

Related Questions

In the spirit of this question by Si here: WiX tricks and tips .
I am implementing URL rewriting in ASP.net and my URLs are causing me a
I have a variety of Velocity template files that represent e-mail messages. I am
After creating a new workbook, I am trying to solve a newly created worksheet

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.