Continuing on fromof this tutorial, this article will guide you through the basics for refining your weapon geometry, adding helpers, material setup and more!
Before we get started, I just wanted to highlight the usefulness of having at least two monitors. If you haven't yet, it's worth investing in a second screen for game development!
First thing we want to do is tidy up the weapon positioning. Currently the characters right hand is too far forward, the weapon in general is too far back/high and the geometry clips through the camera.
Comparing the image above, it's probably a fairly safe bet that we can move the whole weapon forward so that the trigger would be at 0,0,0 position in the Max scene.
Activate the move mode (W) and while hovering the mouse over the 'Y' axis, drag the weapon forward until the trigger is roughly near the center black line:
Now this moves the pivot of our weapon away from 0,0,0 and we'd prefer that to not happen. So in order to get both the trigger and the pivot on 0,0,0 we're going to reset the pivot position.
Click on the third tab called "Hierarchy". Just near the top is a button called Affect Pivot Only which is under "Adjust Pivot".
Click that button and you'll notice the pivot changes its look in the viewport. Now zero out the position in the toolbar as we've done before:
Now select the Affect Pivot Only button again to deactivate it and lets test how that looks in-game again.
Save and re-export your weapon again like we did in Part 1 and go back to Sandbox (hopefully you've kept it open!). The engine should automatically detect the change and update the model.
This is looking a fair bit better but keep adjusting the weapons position as needed.
The weapon is also too high but this can be a quick fix. One common practice is to have your weapon positioned on the 'Z' axis so that the barrel is split in half by the grid, which is best illustrated to explain:
|Z axis Position Before||Z axis Position After - Barrel is split in half|
I know the main body of the gun is 8cm high, as those were the dimensions used to initially create it in Part 1. So I know it needs to be lowered 4cm to be perfectly centered.
Using the same method as we did before, reset the pivot to 0,0,0 again. Test out your weapon again!
Next lets do some "polygon" editing to address the weapon clipping through any geometry.
Select the weapon in the viewport if you haven't already. Click on the second tab "Modify". Under the "Selection" group select the fourth icon called Polygon (aka "Face").
Now if you select one of the faces on the main body of the weapon and you should see it change to to a red color to indicate it is selected.
See how to setup the viewport configuration here:
Since we lowered the weapon earlier, we no longer have it clipping through the camera in first person but it is clipping through the players left hand:
Lets try shaving off 1cm of thickness from the main body, so we'll take off 0.5cm from the left and right sides:
|Left side -2.5cm position changed to -2.0cm||Right side +2.5cm position changed to +2.0 cm|
Save/re-export and test it out!
It's improved, still not perfect, but it will do for an example on how to adjust faces.