Using TRAN in msh files (FAQ)

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
RepSharpshooter
Gametoast Staff
Gametoast Staff
Posts: 1351
Joined: Tue Jul 10, 2007 4:10 pm

Re: Using TRAN in msh files

Post by RepSharpshooter »

If you look through a mesh file with a hex editor, there will be different MODL chunks. You can see these different MODL's in 3DOC via the scene explorer. After each MODL is a TRAN chunk. Inside the TRAN are (after the customary 4 byte long integer telling the size of the chunk) there are 10 floating point decimals. This is what they do:


Scale in X
Scale in Y
Scale in Z
Quat Rotation in X
Quat Rotation in Y
Quat Rotation in Z
Quat Rotation in W
Translation in X
Translation in Y
Translation in Z

You can use this chunk to "tweak" your models after export, if they're incorrect. What I do is import them via my importer, then move the different parts around, then type that transform value into this chunk. It's pretty simple to do actually, had a hard time, cause Riley's Mesh Reference was wrong about this whole chunk.

FYI: Refer to "Adding Cloth" in the "Everything You Need" to understand a little more how to read these numbers, where they are, and how to change them in msh files.

I put boba's cape on a magnaguard, and I needed to scale it up and move it, so this helps here. I also need it for my weapon models that are a little off-scale. This is a big time saver, hopefully.

Image


EDIT
I'm having trouble with using the scale on weapons. When I tried to scale it up, it rotated it instead. It works fine as a prop though. I can't imagine why scale would work for props and not weapons, cause they use the same mesh.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Using TRAN in msh files

Post by Teancum »

It might have to do with heirarchy, I'm not sure. The other problem might be with the fact that it's now got multiple parts. Dunno, just picking as straws here.
wazmol
High General
High General
Posts: 892
Joined: Sat Sep 02, 2006 6:47 pm
Projects :: Thinking...
Games I'm Playing :: Black Ops
Location: London
Contact:

Re: Using TRAN in msh files

Post by wazmol »

amazing find, thanks a lot!
Caleb1117
2008 Most Original Avatar
Posts: 3096
Joined: Sun Aug 20, 2006 5:55 pm
Projects :: No Mod project currently.
xbox live or psn: No gamertag set
Location: X-Fire: caleb1117 ಠ_ಠ

Re: Using TRAN in msh files

Post by Caleb1117 »

This could help Sooooo much with addon meshes, no going back and tweaking it 50 times.

Sorry to bump, but do you mean this section:
TRAN(......?...?...?
So the changes are applied through the red sections?
What if I want to scale it down? that would require the use of more then one space.
RepSharpshooter
Gametoast Staff
Gametoast Staff
Posts: 1351
Joined: Tue Jul 10, 2007 4:10 pm

Re: Using TRAN in msh files

Post by RepSharpshooter »

I'm not sure what kind of hex editor you're using :?
Image
RepSharpshooter
Gametoast Staff
Gametoast Staff
Posts: 1351
Joined: Tue Jul 10, 2007 4:10 pm

Re: Using TRAN in msh files (FAQ)

Post by RepSharpshooter »

I use Hex editor XVI32, you can find it free by googling it.

Scale in X
Scale in Y
Scale in Z
Quat Rotation in X
Quat Rotation in Y
Quat Rotation in Z
Quat Rotation in W
Translation in X
Translation in Y
Translation in Z

The "rotation in w" is what I thought was a scale, but it's actually just like some sort of quaternion rotation thing. I suppose for props though, changing this to a value other than 1 does in fact make it scale.

If you can find TRAN, then it goes like this:
T R A N 00 00 00 00 00 00 00 00 00 00 00 00 etc

The size long integer, 4 bytes long
Scale in X
Scale in Y
etc
Basically count every four bytes starting at the T in Tran. When you arrive at the one you want, just use tools > encode number, selecting a float value, overwriting at this spot (which the spot should be the first byte of the 4 bytes).

^^ this was a pm I sent to someone, clarifying this topic, I'll post it here too so that anyone that may use it in the future will be clarified as well.
Post Reply