Author Topic: Spline Paths Part 2: Rotating the objects following the path  (Read 413 times)

Legacy_Guest_Chrysoli_*

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« on: April 24, 2012, 11:58:16 pm »


               I've always loved this orrery placeable by StoneMonkey: http://nwvault.ign.c....Detail&id=2228

This gave me an idea for one area in our mod that is a rather large (24x24) mountainous region; home to a group of gnome wizards. I  took each individual planet and enlarged it quite a bit, and created new spline paths (once again ala OTR's tutorial) and a separate placeable for each planet, and on for the sun - with the flare emitter inside.

I decided to go with separate placeables for each planet for I could place as many or as few of the planets in a system as desired. The effect is great... a solar system circling high in the sky - passing the floating towers, etc... works great.

But here I am stumped. In spite of combing through the gmax bible, and trying a lot of different rotation controller options, I cannot get the planets themselves to revolve on their axis, as the follow their orbit around the sun. StoneMonkey's placeable did not have revolving planets either.

Additionally, I wanted a few moons that would orbit the planets, as
those planets orbit the sun - and the rings of Saturn spinning around
Saturn.

So I guess my first question is, is that feature even possible: rotating an object as it follows a spline path? and if so, can anyone point me in the right direction to accomplish this?
               
               

               
            

Legacy_Rubies

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #1 on: April 25, 2012, 12:09:03 am »


               You could always use a planet -> dummy -> center kind of arrangement, where the planet's rotation is isolated to itself while the dummy object moves it around? I'm not sure if I totally understand but I'll put up a model file and see if it's what you meant.
               
               

               
            

Legacy_Rubies

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #2 on: April 25, 2012, 12:33:48 am »


               http://dl.dropbox.co...79/orbiting.zip

Worth a shot, right? '<img'>
               
               

               
            

Legacy_Guest_Chrysoli_*

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #3 on: April 25, 2012, 04:31:01 am »


               that's exactly what I wanted to do - so how did you do that (in like ... no time at all '<img'> ?
               
               

               
            

Legacy_Rubies

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #4 on: April 25, 2012, 09:54:29 am »


               I can make a quick video tutorial when I get back to the hotel and I'm not on my phone, if needed, but for now my steps were:

Create 3 objects: moon, planet, and a dummy model that's inside the planet, at the same location, or at 0,0,0.

If you put the dummy under the planet, set its pivot to 0,0,0.(Third tab on the top right toolbar!)

Link the objects together (child->parent) like so: moon->planet->dummy.

Specify how many frames you want the animation to take, and divide it by 360. For ease I used 100 frames, so 36 was my value. If you wanted a smoother and slower rotation, increase the frames.

Turn animation keys on and at a starting key without moving anything, and then every 10 frames, rotate the dummy on the Z axis by 36. Keep doing this, each 10 frames, until you get to 360.

Repeat the last step, only with the planet selected instead of the dummy. I didn't do it with the moon, but because the moon was linked to the planet, it does this automatically.

Jeez, I'm awful at describing stuff. Hope it helps, anyway - if not I can always take a shot at doing it for you.'<img'>
               
               

               
            

Legacy_Guest_Chrysoli_*

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #5 on: April 25, 2012, 04:21:25 pm »


               I will give this a try later tonight. I noticed you had the position/rotation controllers for all three objects (dummy, sun and moon) set to Position: Bezier Position and Rotation:TCB Rotation. Are these *must use* setting for this to happen? I ask this, because I have the planets currently using Position: Path Constraint - to follow the spline path I used to orbit the sun.

Thanks Rubies - I think I understand what you are saying and I'll post back later tonight or tomorrow with a progress update '<img'>
               
               

               
            

Legacy_Guest_Chrysoli_*

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #6 on: April 27, 2012, 04:04:07 pm »


               Had the time to try this out and you were spot on - with the dummy nodes. I can rotate the different planets at different rotation speeds (by setting a dummy node inside the sun, one for each planet that has a different orbital rotation). Then each planet can have it's own individual rotation speed, and by putting planet dummy nodes inside planets with moons, I was able to rotate the moons around planets, each with their own orbital rotation speed, independent of the planet's rotation speed.

Thanks for pointing me in the right direction - this was a very fun exercise! Unfortunately, it's not going to make it into my mod, as the resulting exported mdl file was over 30K, and the exported animations were not near as smooth as they are in gmax - moons and planets stuttered and jumped at times. Plus, after all that, I remembered about the issue I had with animating the sailing ships. That is, if a player gets too far from a placeable origin, unless it's static (which this apparently can't be  - or the planets do not move), the placeable is not rendered for the player to see. With these placeables 50meters in the air - they were never seen in a test area '<img'>

So I thought ... tile... ah ha! Well - I tried it as a tile, and it seemed to be fine and I could view the tile in NWN explorer, so made a hak and test mod, opened the area, placed the tile in the area... it placed ... zoomed the camera out ... crash '<img'>

assertion failed:norm(qTemp)<1.0000f, file:c:\\nwnw|nwnxp2\\dev2\\libraries\\math3d\\math3d.cpp, line 688.

No idea what that means, but obviously that isn't good, and anyway, the stuttering (introduced after I bake the keys with NWmax) isn't acceptable.

If you want to see where I ended up with the idea (in gmax), you can grab the gmax file here:

http://www.nwnlysith...orrery_test.rar

I wasn't too concerned about being scientifically accurate with planet positions, relative sizes and rotation speeds, in relation to our solar system. In fact, had the concept proved useful, I would have likely changed some textures and positioning, to reflect a make-believe planetary system. At this stage, I was checking what could be accomplished with a complex system like this, sized so the outer-most planet's orbit had a radius approx equal to a fair sized NWN area - about 22x22 tiles.

That's my report on that idea (from my level of gmax knowledge ... aka ... pretty limited abilities:). So thanks again!  - this exercise taught me what animation keys actually are - and a bit on how to manipulate them.
               
               

               


                     Modifié par Chrysoli, 27 avril 2012 - 03:06 .
                     
                  


            

Legacy_Guest_Chrysoli_*

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #7 on: April 29, 2012, 09:37:17 am »


               I could not accept that this was not possible. I spent additional time fiddling with this idea and have something that I can use now.

It's still a large model, and does cause a bit of FR drop (but not really that bad - I was pleasantly surprised). The trade off here was I made it a tile, instead of placeable, so the orbital bodies were visible at varying distances, and the overall speed of the system movement is faster then I wanted. Ideally I wanted something rotating slower - about a quarter of it's current speed. But to accomplish that, I really had a monstrously huge file, and I could see no good way to lower file size and maintain a nice smooth animation at that slower speed (that's likely due to my inexperience with gmax/3d modeling in general).

Anyway - thought I'd pass this on to anyone else interested. Thanks again Rubies, you pushed me in exactly the right direction.

Here's a short YouTube Video: Video

Here's a test mod and hak: Downlod Here

Credit to StoneMonkey for his placeable Orrery here: StoneMonkey's Vault Orrery. His textures and basic model was the basis for this project and watching his in-game placeable was the inspiration.

~ Chrysoli
               
               

               
            

Legacy_Rubies

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #8 on: April 29, 2012, 10:17:45 pm »


               I'll take a look at it and see if there's anything I can do to reduce the speed when I get a moment, but I'm glad it worked out for you!

EDIT: That model file must be -enormous-, it's taking ages to load into Gma- oh it's 10 MB. Hopefully I can reduce that size a bit, I'll let you know my steps and all that! '<img'>
               
               

               


                     Modifié par Rubies, 29 avril 2012 - 09:50 .
                     
                  


            

Legacy_Rubies

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #9 on: April 30, 2012, 09:58:04 am »


               The model and animations look great, the size is quite insane, though - do you have a copy of the model before you baked the anim keys that you could put up? The only problem with baked keys is they're particularly hard to edit, and huge in file size. '<img'>
               
               

               
            

Legacy_Guest_Chrysoli_*

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Spline Paths Part 2: Rotating the objects following the path
« Reply #10 on: April 30, 2012, 06:58:43 pm »


               I do - here's the gmax file and the tga's: Final Version

Originally I had the animation End Time set to 16200. This created a monstrous file. I ended up changing the end time to 3600. As I mentioned before, this makes the entire system move faster then I had hoped --- but I can live with it. However, found I was still able to get most of the rotations I wanted, when I discovered I was allowed to do things like use huge rotation angles - so I could really zero in on individual spin rates by say... animating the earth globe at key 1800, with a rotation angle of 7200 degrees, then at key 3600, the same (rotate 7200 degrees again). All the planets are set up the same way ... 3 keys each (0, 1800, 3600) - with varying rotations divisible by 360.


For the orbits of the planets - I used only 3 keys each too - the same 0, 1800, 3600), but used smaller rotation values mostly. For instance, Jupiter's sun dummy (I think) is set to rotate 180 deg at key 1800, and another 180 deg at key 3600. Mercury's sun dummy is orbiting the sun much faster ... key 1800: rotate 2160, key 3600: rotate 2160 degrees. I'm going from memory on the exact rotation values, but hopefully you get the concept of how I did it.

The final mdl is different from this gmax file however. What I had originally done was import Stonemonkey's orrery into gmax, then I removed all animations from the file, to start with a clean slate. Of course his planets were much smaller then I wanted, so I unlinked everything, and added the tcn01 plain cobble tile node (for scale reference). Then I scaled all the planets up significantly (using the *select and uniform scale* button). Then moved them to positions as desired, and created and aligned dummies inside those objects that would have a planetary body orbiting around them. I then linked everything, and created the animation keys.

Now so far everything was great - but when I exported, the Sanity Check told me a few things needed welding. However, when I welded the rings of Saturn, the tga displayed awful - with black shadowy lines now appearing perpendicular to the rings. That wasn't acceptable. Also, the sanity check told me I had objects that were not a scale of 1. I assumed that was due to be re-sizing all the planets, so I fiddled with things like *reset scale* (shooting in the dark for sure '<img'> and when I exported the model, the sanity check passed, but the planets were tiny (original size) again - but all the animations were correct.

So what I did to get the final mdl you have is... one by one, I stripped each planet node from the file, noting it's position and orientation numbers, then ran the nodes through the utility called NWN Scaler, scaling them to the size I wanted. I then put their original position and orientation numbers back into the node, and added the nodes back into the mdl. The rings of Saturn I just did not weld - because I could not stand seeing those shadows,

I just now complied the model too - it's 3700K complied. That's the first time I've seen an ASCII model compile into a binary file, where the resulting binary file was smaller then the ASCII - in this case ~ 66% smaller. I'll be testing it in game sometime today to make sure it compiled ok. On my coding machine, an older dell optiplex with 2gig ram and just simple on-board intel graphics, the model runs fine for me in the area (a rather large area in fact). There's very little stuttering or lag, however there is a little - but it's acceptable I believe. On my newer sony laptop, with pretty high-end specs, there's nothing with load or lag that I can even detect with this model in the area.