Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (Dico), 16,767 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
One ENTITY revolving around the other #221230
08/12/08 23:08
08/12/08 23:08
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
I need to build a model of the solar system ... I can build models with MED and as you can guess I build the system all in one model, this was ok and looked nice when I used rotate. But I'd like to build all the planets and sun as their own ENTITIES. How would I then get the planets to revolve around the sun and at different speeds and distances. If any one knows of some code examples or a quick snippit to point me in the right direction would be huge .... thanks.

Re: One ENTITY revolving around the other [Re: phmenard] #221311
08/13/08 13:06
08/13/08 13:06
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline
User
Trooper119  Offline
User

Joined: Apr 2004
Posts: 516
USA
Like many solutions there is a large scale way of doing this, and a low scale solution of doing it. If I can assume your only building one or just a few solar systems and not a whole galaxy of them, this would be fairly simple.

The sun is the key to this, make a global array and a counter, set the counter to 0 at the start of the game. In your sun action, assign a pointer to the sun in the array[counter] slot and then increment the counter.

Every planet that you want to revolve around these sun's you create you simply assign a number according to the sun that you want them to revolve around (first sun would be 0, second sun would be 1 ect.). Then you just assign your movement code to reference array[currentSun].x, array[currentSun].y, and array[currentSun].z to find the position of the sun you want.

I'll assume you already have the code for revolving around the sun. But this should be fairly simple to do, so good luck.


A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: One ENTITY revolving around the other [Re: Trooper119] #221350
08/13/08 16:17
08/13/08 16:17
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom

Re: One ENTITY revolving around the other [Re: DJBMASTER] #221433
08/14/08 01:49
08/14/08 01:49
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
Wow ... thanks, that's just what I was looking for ... :-) Nice code. I have a few other dilemmas, what about an elongated orbit ... like an asteroid or comet. How would I teach these objects to be aware of each other ... and know when they are close to one another or side by side??

Re: One ENTITY revolving around the other [Re: phmenard] #221446
08/14/08 02:58
08/14/08 02:58
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline
User
Trooper119  Offline
User

Joined: Apr 2004
Posts: 516
USA
I haven't looked at the code he gave you but there are two ways of doing what you ask. The hard and most flexible way is to implement gravity physics into your code where the asteriod scans the planets and such for their mass and based on its proximity moves based on the gravity that effects it. The easy way and less flexible way is to give the asteroid a uneven radius (x has one radius length, and y has a different one) this would give an oblong path of movement, and then you would place its origin wherever you deem appropriate, but all of this would be manual, but very easy going on your computer.


A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1