How do I make earth rotate around the sun? Forum Home > Construct 2 General > How do I....? |
Post Reply
|
Page 12> |
| Author | |
Post Options
Quote Reply
Topic: How do I make earth rotate around the sun?Posted: 28 Oct 2011 at 12:30am |
|
|
I know, should not have missed some math classes. I am trying to make an object move around another, like earth move around the sun. But I don't know how to do it.
I need the object that is moving always face the object it is moving around. Sorry for my poor english. It would be nice if it were possible to rotate an object using it´s Image Point. |
|
|
Apimenti Games
games.apimenti.com |
|
![]() |
|
Post Options
Quote Reply
Posted: 28 Oct 2011 at 12:35am |
|
|
Take a look at the Pin example that comes with the latest build, that should help you.
|
|
![]() |
|
Post Options
Quote Reply
Posted: 28 Oct 2011 at 12:47am |
|
|
I see. In that example the object rotates, then others move around. This is the only way?
I mean, I don´t want the object in the center rotates! |
|
|
Apimenti Games
games.apimenti.com |
|
![]() |
|
Post Options
Quote Reply
Posted: 28 Oct 2011 at 12:50am |
|
|
The math you need is:
Set X to CenterX + cos(angle) * dist Set Y to CenterY + sin(angle) * dist CenterX/Y defines the center point of the circle, at the give angle, with a radius of 'dist'. Math is actually really helpful in game creation, it's worth brushing up! Edited by Ashley - 28 Oct 2011 at 12:51am |
|
![]() |
|
Post Options
Quote Reply
Posted: 28 Oct 2011 at 2:22am |
|
|
I know @Ashley! Math is good!
Thanks to your formula I was able to reach my goal. I would like to share what I just learned. Here is an example of what I wanted to do. The project file (.capx) is also available! Edited by Jailson - 28 Oct 2011 at 2:32am |
|
|
Apimenti Games
games.apimenti.com |
|
![]() |
|
Post Options
Quote Reply
Posted: 28 Oct 2011 at 12:45pm |
|
|
Yes please Jailson, post the capx for this very example.
I added this topic in the FAQ. |
|
![]() |
|
Post Options
Quote Reply
Posted: 28 Oct 2011 at 12:58pm |
|
|
@Kyatric, the .capx is available at the example link. Below the demo.
But if you want it here, no problem, here it is. |
|
|
Apimenti Games
games.apimenti.com |
|
![]() |
|
Post Options
Quote Reply
Posted: 28 Oct 2011 at 1:04pm |
|
|
Oh sorry, I didn't pay attention and missed the link.
Well at least it's here too now. Good job, thanks for the example. |
|
![]() |
|
Post Options
Quote Reply
Posted: 28 Oct 2011 at 3:52pm |
|
|
Yeah that's a pretty standard formula, and can be applied in a ton of different ways.
..... wouldn't mind seeing it as an expression in C2. |
|
![]() |
|
Post Options
Quote Reply
Posted: 11 Jan 2012 at 6:17pm |
|
|
This is something I'd been trying to get to work, so this is very helpful. What would you need to do to let the player control rotation? I'm thinking of using this method for a targeting cursor that rotates around the main character when the player aims.
|
|
![]() |
|
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |