Need examples of spinning circle around an object.Unanswerd

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Need examples of spinning circle around an object.Unanswerd

Post by cameron » August 8th, 2012, 9:27 pm

Hello everyone.I need to make a circle spin for one of my games I know how it might work. But I need some examples of a spinning circle sorce code.Any comments are appriciated. Thanks chili for all your hard work. :D
Last edited by cameron on August 10th, 2012, 2:52 am, edited 3 times in total.
Computer too slow? Consider running a VM on your toaster.

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Would like some help to make a circle spin.

Post by LuX » August 8th, 2012, 9:40 pm

How do you mean spin?

With like an image in the middle like a wheel or some kind of a physics thing or what? Be more specific.
Generally a blank circle is already "spinning", depends how you imagine it.
ʕ •ᴥ•ʔ

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Would like some help to make a circle spin.

Post by cameron » August 9th, 2012, 6:48 pm

Ok sorry Lux I mean i have a circle drawn and I want that circle to move around in a circle.In other word I want a circle to spin around an object.
Computer too slow? Consider running a VM on your toaster.

Lorth
Posts: 139
Joined: July 19th, 2012, 4:12 pm

Re: Need examples of spinning circle around an object.Unansw

Post by Lorth » August 10th, 2012, 4:28 am

Like the moon circles around the earth? :D

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Need examples of spinning circle around an object.Unansw

Post by LuX » August 10th, 2012, 9:17 am

Or like the sun circles around the earth?

...Wait what?

I think the answer can be found on multiple topics on planet chili, but it shouldn't be too hard to search from the web.
ʕ •ᴥ•ʔ

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Need examples of spinning circle around an object.Unansw

Post by chili » August 10th, 2012, 2:16 pm

You need to make an angle variable, and then every frame you increment the angle and then rotate the coordinates of the circle by the angle.

The transformation is:

x' = x cos(a) - y sin( a )
y' = x sin(a) * y cos( a )

Google rotation transformation and do some research if you are still clueless.
Chili

User avatar
XxWalKaxX
Posts: 244
Joined: June 11th, 2012, 7:15 pm

Re: Need examples of spinning circle around an object.Unansw

Post by XxWalKaxX » August 10th, 2012, 3:06 pm

what includes are needed for trig operations, math.h??
What you call a bug...I call a new feature!

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Need examples of spinning circle around an object.Unansw

Post by LuX » August 10th, 2012, 3:08 pm

Yeah, but since were into C++ stuff, use <cmath> instead. No real difference between 'em.
ʕ •ᴥ•ʔ

Post Reply