www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tomb Raider Level Editor Tutorials

Closed Thread
 
Thread Tools
Old 26-07-14, 07:04   #1
A_De
Explorer
 
A_De's Avatar
 
Join Date: Jan 2012
Location: Kazakhstan
Posts: 751
Default TRW Editor: mirroring and transferring animations

Long time ago the first open to discuss version of this tutorial was created. Here is the final version with all founds put together

This tutorial explains how to transfer animations between movables with different meshtrees. Here also explained how to mirror animations without getting into any CAD program.

Important: first you should read the manual included in Sapper's TRW-Editor’s package because it is necessary to understand the further process.

A) Applying movable’s animation to another movable.

You need to know which mesh-tree is used on certain movable. I made visual schema for this:

Each number shows the mesh index. You see that they are different for body parts of movables.

First export the *.trw animation you want to transfer between movables (In this example it was the guide’s animation which was applied to trc-baddy later). Open *.trw in TRW Editor and save it as a *.csv. CSV is a text file which can be edited in table editors like Excel. You will see the rows and columns like these:
Code:
bbx1	bbx2	bby1	bby2	bbz1	bbz2	offx	offy	offz	Msh0 rotx	Msh0 roty	Msh0 rotz	Msh1 rotx	Msh1 roty	Msh1 rotz	Msh2 rotx	Msh2 roty	Msh2 rotz
-566	-257	-613	5	-178	180	-434	-272	-96	6		80		0		276		989		928		753		0		0
-566	-257	-613	5	-178	180	-434	-272	-96	6		80		0		276		989		928		753		0		0
-566	-257	-613	5	-178	180	-434	-272	-96	6		80		0		276		989		928		753		0		0
-566	-257	-613	5	-178	180	-434	-272	-96	6		80		0		276		989		928		753		0		0
-566	-257	-613	5	-178	180	-434	-272	-96	6		80		0		276		989		928		753		0		0
-566	-257	-613	5	-178	180	-434	-272	-96	6		80		0		276		989		928		753		0		0
-566	-257	-613	5	-178	180	-434	-272	-96	6		80		0		276		989		928		753		0		0
Now you have to match animations to meshes of new movable. Msh0, Msh1, etc. are mesh numbers, each mesh has it’s rotation parameters in 3 columns. For example, guide’s left shoulder has the mesh num = 12 while TRC-baddy’s left shoulder have the mesh num = 8. So if you want to transfer guide’s animation to TRC-baddy you need to replace all values from three Msh8 columns with values from three Msh12 columns. This must be done with all meshes which have different numbers. However, you can see that the guide has 25 meshes while TRC-baddy has only 15. This means after matching mesh numbers you must delete the columns belonging to meshes above Msh14. After that save your *.csv.
I had to check it in notepad because for some reason the numbers were divided with ; instead of , and this has been fixed manually. Open the *.csv in TRW Editor, set the required frame rate and other parameters and save as a *.trw.
Import this animation into new movable. If everything was done correctly you will see you movable with new animation. If not… well, don’t save your wad, and try again

The guide you see in the picture was made by Trinity, White Tiger (meshes) and Bojrkraider (animations). Some meshes are empty (8-11, 15, 19-20, 22-24), and they don’t need to present in new movable in this case.

B) Mirroring Lara’s animations

You’ll have to repeat some steps described above. Open the CSV animation in Excel or similar program. I mirrored the right-leg-kick animation and followed these rules:

1) OffX values must be inverted (each OffX = OffX*(-1)), OffY and OffZ stay untouched (Position)

2) Msh0 RotX stays untouched, Msh0 RotY and Msh0 RotZ are inverted (rotation of Lara’s butt)

3) For Msh7 and Msh14 see the rule above (rotation of Lara’s torso(Msh7) and head(Msh14))

4 ) The legs must be swapped:
a) You have to swap Msh1 and Msh4, Msh2 and Msh5, Msh3 and Msh6 columns
b) Their RotX stays untouched, RotY and RotZ must be inverted

5) For the arms you have to do almost the same:
a) You have to swap Msh8 and Msh11, Msh9 and Msh12, Msh10 and Msh13 columns
b) Their RotX stays untouched, RotY and RotZ must be inverted

After that save your CSV, convert it to TRW and import. If everything is correct you’ll see your animation is now mirrored. Here’s the preview – some kind of sport-kicks (Notice that I did not mirror the head and arms, it’s a test after all ).

As you can see, here is nothing as complicated as it looks.

-------- Additional utilites by Krystian --------

Krystian did a lot of work to make mirroring animations faster and more user-friendly. He made several macros for MS Excel which can be used for different purposes.

List of macros with short descriptions:
Quote:
- Animation_Mirror_Lara :
Instantly mirrors an animation horizontally. It works exclusively for Lara's animations. If you need to mirror
an animation of another object, use the following macros: Mesh_Value_Swap, Mesh_Rotation_Invert, X_Position_Invert.

- Animation_Reposition :
Offsets the entire animation's position values (each frame) by a specified amount of TRLE units, for each
coordinate (X, Y, Z).

- Animation_Rotation :
Offsets the entire animation's rotation values (for each frame) by a specified amount of Rotation units, for
each axis. This might be confusing, so it is explained that the common horizontal left/right rotation is in
the Y axis. Note that this will only change the rotation throughout the animation, and NOT the positioning.

- Animation_Rotation_Reposition :
Calculates the rotation, as well as position values in the X and Z coordinates, based on the specified amount
of degrees. It is important to note that the rotation process proceeds in a clockwise direction, so a value of
90 will perform a 90 degree RIGHT turn, while a value of 270 will peform a LEFT turn, and 180 will do an
expected 180 degree half turn (you can of course input any value enclosed in the 0 to 360 range). Use this if
you really need to rotate an animation in which there is a change in position. Otherwise, if the root mesh
(mesh 0) doesn't change position, it's best to use Animation_Rotation.

The following three macros, are used to mirror animations for other objects, and have little or no use otherwise.
The process unfortunately must be more manual, because various objects can have different mesh trees and mesh
amounts.

- Mesh_Rotation_Invert :
Recalculates the Mesh RotY and RotZ values for the selected mesh (range 0-31).

- Mesh_Value_Swap:
Swaps mesh rotation values between two selected meshes (range 0-31). Used to swap symmetrical
mesh counterparts (e.g. right arm with left arm, left leg with right leg).

- X_Pos_Invert:
Makes the X position values for each frame opposite.
Here is the download link to utilites - a bit late, but still better than never See included readme file for all necessary instructions on how to use macros and give credit to Krystian.

If you have suggestions or comments please post them in discussion thread
__________________
Camel Luddick hates the tombs.

Last edited by A_De; 22-01-15 at 05:43. Reason: MS Excel macros added
A_De is offline  
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 03:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.