The Problem: A turret who's guns did not follow the turret body when tracking.
While working on a mod, trying to figure out why the main guns of a cap ship were not able to fire, I noticed the ships main turrets behaving in an odd manner:
Which prompted my posting for help in the XFP forums. Observe got ahold of me in IM, and with his help, I was able to find out the above results was because the guns were rotating on their own pivot point, and not the turrets.
Observe had me check each guns pivot points, and to reset them to 0,0,0 on the grid.
This entailed several steps in 3DS Max:
Load the gun (left or right) with DBOX2 with 'Highest LOD only' unchecked, and 'Detach parts' checked (explained later) Aligning the 'Pivot' area to 0 on the X, Y and Z axis. Changing the 'Pivot point' to match the new alignment. So I loaded both the guns. Because I wanted to make sure they ligned up, not only with the pivot point, but with each other (I'm a bit of a perfectionist with alignments ). Once I had them ligned up with each other, I took note of the coords, then cleared and loaded one at a time to adjust their positions.
I was ready for the next step.
I clicked on the gun to select it, pressed the 'Hiearchy' button in the list of tools, selected 'Pivot', then in the 'Adjust Pivot' rollout, selected 'Affect Pivot Only'.
I then selected the 'Select/Move' from the top:
In this mode, you can alter an objects pivot point to wherever you want it to be. I used the coord area to center the point to 0 on all 3 axis:
Now that the guns position and pivot points are set, we need to save the gun.
The reason I loaded the gun with the 'Detach Parts' option, was to unbundle a specific detail necessary for the weapons operation. That is, the 'laser'
If you've read DS's 'Modding Doc' from the DBOX2 rollout, you'll know the laser plays an important role. DBOX is not only able to export the laser with the body, but is able to update the Components.txt file with the guns laser information. (i.e.: where it fires from, and the direction).
Normally, the laser is linked with the gun, so even the Detach Parts option, coupled with any moving of the gun itself, will not dislodge it. The Detach Parts just makes it accessible to you, for exporting the components entry and final saving of the gun. It is only with new guns that you'll have to make a 'laser', and link it to the gun. (See DS's Doc)
With just the 1 gun loaded (or both, if your careful with draging selector lines), hit ctrl-a to select all (not if you have more than one item loaded ). This will select the gun and the laser. This is important.
Go to DBOX, and in the Exporter rollout, select 'Body'. You can use either Export Set or All, depending on the situation. This saves the gun's current coords, its mesh, and the laser information.
If you've moved the guns coords, you'll need to use the Components rollout, and Export the guns laser information.
You next need to load the scene file for the turret (Detach Parts UN-checked), and make adjustments to the loaded positions of the guns, especially if you altered their coords. Then, using the Exporter, Select 'Scene' and 'Export All'. This will update the scene file (or make a new one) with the positions of the turrets parts.
It was at this point I thought I was finished. I loaded all the files into the mod, and ran it. The turrets STILL behaved badly.
Because of the guns position, Observe told me to load up the scene, then drop it's Y axis to 0, then adjust its Pivot Point. When I was preparing to do this, I had another notion. So I loaded the Scene with Lod off and Detach parts on.
I then selected each gun, opened the Pivot manipulation, and adjusted the guns X axis pivot Point to 0, based on where the gun was sitting in the scene. Next, I selected each gun, and its laser, and saved its body to file and exported the components information.
Once both guns had been adjusted, I selected everything in the scene except the lasers (not needed for the scene) and saved the scene. Adjusting the Pivot Point like this does cause the scene file to be needing an update.
So here we go again. Loaded the bods into the mod, and ran with it, fingers crossed. Lo and behold, the turrets behaved themselves.
So remember, with articulated turrets like this one, there are 3 different pivot points:
1) The point the 'Body' of the turret uses to rotate around
2) The point a 'Gun' uses for up/down tracking
3) The point the 'Gun' is supposed to use to maintain it's 'position' with the 'Body', and the rest of the turret, when it's in motion.
Understand, in Max, the X and Y pivot points are for 2 and 3, and are not mutually exclusive.
Also note: Changing a guns Pivot Point can alter (and usually does) where the gun will load in a scene, so it's important to update the scene files after such adjusments.
Now, I wasn't quite through. If you notice, the guns for this turret are rather blocky looking, even the 'pipes' coming out of their back ends are blocking looking. So I decided to try something I found earlier.
3DS Max 8 (not sure about GMax or earlier 3DS versions), has an interesting feature called 'Use NURMS Subdivision' (Non-Uniform Rational MeshSmooth).
With an object selected (don't select the laser ) click on the 'Modify' button, and scroll down to the 'Subdivision Surface' rollout. Here you'll find the NURMS option.
Now NURMS does 2 things:
1) It attempts to smooth out your object more than it is already 2) It increases the vertice(edge)/poly(face) count of the object. For exampe:
The above image shows a non-NUMRS gun (Top), and one that NURMS was applied to (Bottom). As you can see, NUMRS rounded out a lot of the 'angles'. It even smoothed out the pipes coming out of the rear of the gun.
The top guns Vertice/Poly count is: 414/540 The bottom guns Vert/Poly count is: 1892/1620
The overall Vertice (Edge) count went up over 4.5x, and the Poly (Face) increased by 3x. Depending on the complexity of the mesh NURMS is applied to, results can be different.
The original content of this article was imported from DeadlyDa and doubleshadow's X-Wiki.