
02-Dec-2011 03:15
I'm kinda surprised this hasn't come up more often. Anyway, the trick is to have the right 'pivotx/y/z' values for the rhand in the 3do hierarchy (a kind of 'skeleton' for the model). These 'pivot' values offset the geometry of the weapon mesh, as well as where the lightsaber blade begins. ZED zeroes out these pivot values and applies the offset to the geometry directly.
To bore you with technical details

, given a pivotx/y/z of "0 0 0", the JK-rendered lightsaber blade extends out of the position of the k_rhand node. The weapon models are constructed such that, when attached to the player model, the end of the lightsaber handle is at that same position, so the lightsaber blade will come out of the end of the handle. The actual position of the k_rhand node is in the middle of the wrist, so this is why the weapon model appears lower than it should with zero pivot offset. A pivotx/y/z offset needs to be applied to shift the model (and the lightsaber blade endpoint) to the correct position.
The player model will have a 3do hierarchy node called 'k_rhand'. This node might have geometry (surfaces, vertices, etc.), or it might be an empty node. In either case, the k_rhand node is the one where the weapon models are attached.
(The first set of steps)
If your model has no k_rhand geometry (like the original LEC models -- the player model has no hand, and the hand is part of the weapon model), then you just need to do the following after exporting your model:
- Open the model in a text editor and scroll all the way to the bottom (labeled SECTION: HIERARCHYDEF)
- Find the k_rhand node and set the last three values (pivotx/y/z) to "-0.002488 0.009120 -0.005542". For example, change
|
12: 0x0000 0x00004 13 11 -1 -1 0 0.001632 0.003386 -0.028002 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 k_rhand
|
to
|
12: 0x0000 0x00004 13 11 -1 -1 0 0.001632 0.003386 -0.028002 0.000000 0.000000 0.000000 -0.002488 0.009120 -0.005542 k_rhand
|
- Save the model file
If your model includes geometry for the k_rhand node (like the JKE models -- the player model has the hand, and the weapon models have no hand), then it gets a little more complicated.
(The second set of steps)
We'll "prepare" the model so the rhand is un-offset (I.e. the hand will line up with the weapon). This is a one-time step, and, despite being called the "second" set of steps, you actually carry these steps out first.
- Open the model in a text editor and scroll to the bottom (SECTION: HIERARCHYDEF)
- Find the k_rhand node and set the last three values (pivotx/y/z) to "0.002488 -0.009120 0.005542". Note that these are the negated offset values that will be in the final version. For example, change
|
12: 0x0000 0x00004 13 11 -1 -1 0 0.001632 0.003386 -0.028002 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 k_rhand
|
to
|
12: 0x0000 0x00004 13 11 -1 -1 0 0.001632 0.003386 -0.028002 0.000000 0.000000 0.000000 0.002488 -0.009120 0.005542 k_rhand
|
- Save the model file
- Import the model into ZED and export again
Now, ZED has zeroed the pivot values and shifted the geometry. If you view the model in ZED, the rhand will appear "below" the wrist, like the weapon model does in JK. This is ok, because setting the the pivotx/y/z again to the original values will push the hand back to where it should be when JK renders it.
When you want to use the model in JK, make sure it has the pivotx/y/z values set to "-0.002488 0.009120 -0.005542" (follow the first set of steps above).
When you want to import the model into ZED for editing, make sure it has the pivotx/y/z values set to "0 0 0" so ZED doesn't offset the rhand. If you forget, you just need to follow the second set of steps again.
I realize this is rather wordy. As always, I'm finding this procedure difficult to explain clearly. If you have trouble, just post back and I'll try to clarify.
Maybe someday I'll write a script or a plugin that fixes player model offsets...