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

Related Questions

In trying to solve the ajax back button problem I have found the Really
I'm trying to solve the 3n+1 problem and I have a for loop that
I'm trying to solve this flickering problem on the iphone (open gl es game).
I have a problem I'm trying to solve involving interfaceing a C++ program with
I have sort of a tricky problem I'm attempting to solve. First of all,
I'm trying to solve a tricky problem in Google Maps (api V3) Works nicely:
I've got a rather tricky problem that I've been trying to solve for the
Trying to solve that problem, but no luck for hours... I have var screen1
I was trying to solve my XNA Font problem , when I found this
I'm trying to solve the problem of passing a 2-dimensional table into JavaScript AJAX

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.