Moving an object in a circular path
-
I want to move one object (dot) in a circular path. How should I change the X and Y coordinates to accomplish this?
-
Answer:
You can make it by using simple math. X := originX + sin(angle)*Size; Y := originY + cos(angle)*Size; Origin is the center of your circle. Size is the radius of that circle. Thats it.
Ganapathy at Game Development Visit the source
Other answers
There's another trick, where you use the sin(x+a) and cos(x+a) formulas, and that allows you to compute sin(a) and cos(a) -- a being the angle by which you want to move from your current position -- only once and do simply multiplication and additions at each step. sin(x+a) = sin(x)*cos(a) + cos(x)*sin(a), iirc. Of course, that assumes constant angular velocity.
sylvainulg
Related Q & A:
- How To Send a Complex Object to a Rest Web Service?Best solution by codeproject.com
- Where did a downloaded file from SharePoint come from? (it's SharePoint path?Best solution by SharePoint
- How to save jQuery object in a cookie?Best solution by Stack Overflow
- Is a Paralegal career a good path to Law school?Best solution by profj.us
- Need help choosing a career path?Best solution by forbes.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.