Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / moving objects around abjects [DBP]

Author
Message
Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 20th Sep 2005 20:49
I have been trying and Failing misserably to get an object to rotate around another object without having to create a limb. what I am trying to do is create a central planet and a few "Moons" and have the moons circle the planet on different plains and at different speeds. similar to a solar system model.
any help would be wonderfull and thanks in advance!!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Sep 2005 21:36
A little demo I had 'lying around'!

(No media required).



TDK_Man

Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 20th Sep 2005 22:04
Thanks for the input TDK, I will have to play around a little to get it right(within my code) but the concept is correct! thanks!

oh by the way I have the code I am working on posted in another Forum check it out here-->http://forum.thegamecreators.com/?m=forum_view&t=60900&b=6
Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 21st Sep 2005 17:18
ok TDK , Thanks again for the sample you posted it was a HUGE Help! I was having trouble with it only working like a pendulum when I first cut and pasted the parts I needed, then I went back and after some trial and error I found that making the change in this section:

X# = WrapValue(X# + AngleInc)
Z# = WrapValue(Z# + AngleInc)

was all I needed to do so mine now looks like this:

X# = WrapValue(Z# + AngleInc)<--swapped out x value for z value
Z# = WrapValue(X# + AngleInc)<--swapped out z value for x value

and now the planet rotates around the center one perfectly!

then I added a few more planets and set them up on a slightly forward or backward path,

Position Object 3, newxvalue(0,X#,XDist#),newyvalue(0,Y#,YDist#),newzvalue(0,Z#,ZDist#)
Position Object 2, newxvalue(0,X#,XDist#),newyvalue(0,Y#,YDist#),newzvalue(0,Z#,ZDist#)
Position Object 4, newxvalue(0,X#-3,XDist#-30),newyvalue(0,Y#-3,YDist#-30),newzvalue(0,Z#-3,ZDist#-30)`<-make this one slower.
Position Object 5, newxvalue(0,X#+90,XDist#+90),newyvalue(0,Y#+90,YDist#+90),newzvalue(0,Z#+90,ZDist#+90)`<--make this one faster. (this object actaully rotates on an eliptical path (very cool))

and now I have a few planets that seem to be on their own plains and rotating at their own speeds! it looks great and I was able to keep the frame rate up as well! ( I will post the updated code in the snippets forum I have already posted this code in.) due to the changes I made in the code, the planets do not just rotate on a x plain or y plain but actually all plains at once (in a slow wobble, just like earth) giving it a very realist look.

again TDK Thank you so Much! your help is appreciated!
Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 21st Sep 2005 17:28
here is a screen shot

Attachments

Login to view attachments
Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 22nd Sep 2005 15:03
hey TDK, is there any chance of you digging up the IDE you made for DBP, I can find the DBC one but I am running pro, and would love to have the fine editor you made as it looks much better and easier to work with!! PLEASE PLEASE PLEASE!?!?!?!?!?!?
Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 23rd Sep 2005 23:41
ok, I have another question, I have been able to move objects in 2 directions around another object, (Thanks to TDK_Man) but now I am trying to get onther object to rotate around a second object as it goes around (IE: 3 spheres, 1st sphere is at 0,0,0 and is the center of the rotation, second sphere is rotating around 1st sphere, now I want to have the 3rd sphere rotate around the 2nd sphere as it rotates around the 1st spere. (does this make sense?) the thing is if sphere 2 is rotating around spere 1 on x axis, and I want sphere 3 to rotate around sphere 2 on the y axis.(i'm thinking this would look strange and cool at the same time!!) but so far I am having no luck, I've tried to change the code from TDK_man to make this happen but it will not seem to follow the object correctly (i get the correct spin but cannot stay on the axis with the planet at it rotates.)

any help is very appreciated as always! you can see the code I have so far On the SNippets forum at
http://forum.thegamecreators.com/?m=forum_view&t=60900&b=6

the idea behind this code is a simple planetary model, that you can fly around in and look at the different planets, and the center planet has some fire inside( it's the particle code) that (when covered by a texture) only shows the last parts of the paticles as they are released from theplanet to space (it's real cool to watch as it looks like small volcano's erupting on the surface and then dying out.) at some point I want to add code that will make the center planet actually "Blow-up" (and maybe become a sun)but that is for later on. for now I need to get the planets to rotate in different directions and on different plains, and I would also like to add some type of gravity as the planets near each other they could pull on each other some how and make differnt things happen (starting to get to deep now.) like when a planet gets close to the center planet maybe it could draw out more of the particles from inside and make them head out into space at a higher speed while the planet is near and when it goes further away they would go back to normal.

Thank in advance for your help/suggestions!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Sep 2005 00:25
Would you be trying to get the moon to orbit the earth while the earth orbits the sun?

Here's the source code to my unfinished Solar System Demo - I have no intention of doing anything more with it. It's old, but you might glean something useful from it...

http://www.computechtenerife.com/solarsystem.zip (4MB and all media files are included).

The source is DB Classic and probably won't run in DBP. Also, the text on the main screen flickers when interpreted but is fine when compiled, so there's nothing wrong!

TDK_Man

Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 24th Sep 2005 01:37
TDK..... I bow to your GREATNESS and GRACIOUSNESS! you are truly an Honerable and Most Talented GURU! this code is
Quote: "spectacular"
! why did you stop?
you are right it does not work well with DBP, but it does compile without errors, it just has a few things that probably need tweeking.
anyway WOW, I was lookiing through it and I am sure there are some areas I can get the things I need from. I don't plan on being quite so complex at the moment but the fact that the code looks so nice and so WELL Commented (*Clap, Clap, Clap* KUDOS!) that I think I am going to be inspired as I learn to do it Right and do it Well!
you are truly a great mentor for the community (I have seen alot of your posts in others I was looking at) and I totaly appreciate your help!

I am gonna go and do some more lookin and I will let you know later on this weekend how it goes!

TDK, TDK, TDK
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Sep 2005 02:13
Calm down for goodness sake!

It's only a bit of DB code...

As I said, feel free to do what you wish with any of it - if you find a use for it.

TDK_Man

Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 24th Sep 2005 02:24
OK I Just couldn't wait I started lookin around and REM'd out the sounds and recompiled and it runs! the menu still flashes, but it ran! and WOW, again I bow to the MASTER! it looks incredible! I had to turn off tracking durring init but then WOW, the sky looks awsome and the ability to watch and trach planets, and fly around like in a ship I just can't believe it!! the only real issue I am having is everything is moving so dam fast! (haven't checked frame rate but it's gotta be up there and this CPU is a screamer!)
When I get done playing around with this code, I am gonna email it back to you and let you re-post it (if you want) because this was a lot of thought and effort and the results show it!!
man I gotta go see more!!!!!
Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 24th Sep 2005 06:08
ok it only took a little while to get rid of the flicker in the menu,(REM'd out a few unneeded "sync" commands in the Menu sub area).
this also had another effect (it made the textures on the planet surfaces much smoother looking, and makes the planets movements seem less eratic and more even.)
I added 2 seperate camera move + and - to get around in the environment quicker (there is no inertia on the movement though, unlike the movement that was already there.)I noticed that the menu said(and now I can actually read it !!!) this move was available by pressing + and - but it did not work for me so I just added a couple real quick.
now that the menu does not flicker I noticed the detail on the earth behind the menu and I noticed that the clouds move one way and the earth the other, see that's the kind of detail I was talking about, TDK you are the MAN! I have been enjoying cruizin around in this little world!
and with only a few more minor changes I think you will have a nice little bit of PRO code to share. and I think as my contribution I am going to make some custom background music loops and a few new sound effects to get it back to full functionality. (since those are the things I had to remove to make this work.)
I am suprised with as helpful and generous as you seem to be on this forum that you are not a moderator. if any are watching I vote for "TDK" for Moderator (provided he wants to be one) it's people with TDK's skill and ability to teach and help that make 3d programing possible for more than just super brainy people.

well, all that being said, thanks again TDK!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Sep 2005 17:36
Quote: " I added 2 seperate camera move + and - to get around in the environment quicker"


Yes - that's one of the things I never got around to adding.

The thing to note here is that the code in the download works perfectly in DB Classic. If anyone downloads it who uses DBC, just compile it and use the EXE. No changes are necessary unless you run it in DBP. Eg:

Quote: "REM'd out a few unneeded "sync" commands in the Menu sub area"


Take these out in DBC and the menu doesn't work...

TDK_Man

Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 26th Sep 2005 23:21
ok on playing with the code over the weekend I found that removing one(1) sync command was al that was needed to clear up the menu, and removing the music calls, was the only other thing I really did to make this code work with DB-Pro, I would have to agree that the code is probably Flawless in classic, but I don't have that version. I am however super impressed with the fact that this code is so good it works in both versions(with only minor adjustments for PRO.)(as TDK said, this code work fine without changes in Classic, but in pro there are only a few simple changes that need to be made to compile and run, so if you have classic just comile and go, if you have pro, then simply remove the music calls and the "sync" command from the bottom of the Menu Sub , and it should compile fine and run well. oh, yea, I also added a line at the top to set the (auto)tracking to off when you start the program , otherwise the camera spins with the planet that gets selected, and can make you dizzy quickly. (mostly because the whole thing was running so Dam fast on my machine!) <-- This Code ROCKS!

and after spending time watching and playing with the solarsystem< i have no urg to do anything to change the code that TDK has made.(if you haven't checked it out, you should! it's truly a great bit of code and very helpfull! and the final product looks great! even if TDK says it's unfinished!)

ok, now I have gone back to my SolarSystem Model (which is not based on reality!) and using some techniques learned from TDK's great project I have got planets that rotate around planets with satalite planets around them moving in different directions and different speeds. But what I am finding is that the "Orbits" deteriorate after a few minutes and then start to change, some planets eventually end up moving back and forth (throught other planets) and some just move to different locations and get smaller and smaller orbits. I am not sure why this is just yet, but depending on how you look at it it's either really cool or a big drag.

More Later......
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Sep 2005 20:07
That last problem you described sounds very much like a compounding floating point error.

Somewhere in your code, you may have an integer variable which is rounding a float value to integer.

Over time, this error grows until it becomes visible.

Make sure all your variables to do with 3D positioning are floats (with the # symbol at the end of the variable name) and that when you use a whole number in a calculation, you put the '.0' on the end. Eg:

A# = B#/3.0

rather than

A# = B#/3

TDK_Man

Angry kreyon
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location:
Posted: 28th Sep 2005 22:53
Thanks TDK I will take a look and make the needed changes, sounds like you are probably right on target, I dont remember right off hand and I do not have the code handy today to look right now, but it seems to me there may be a number ( or numbers) that end in something other than .0 , and I will make sure that they have the # after them as well.

Thanks again for the great feedback!

Login to post a reply

Server time is: 2024-11-27 16:45:13
Your offset time is: 2024-11-27 16:45:13