TRAN section in msh

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
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

TRAN section in msh

Post by Anakin »

Hi,

i saw this tutorial here:
http://www.gametoast.com/forums/viewtop ... 27&t=12263

But i at my hex editor there is no float value. i only have IEEE for double but it's longer than 4 byte

==EDIT==

ok i got it to change the values. But now i have the problem, that the values don't behave like i think.

First i changed the size. worked fine. than i rotated around the y achse.but when the value became bigger than 0,75 (i changed the scale to 0,75) the object became bigger. -.- So is there maybe a trick how to move and scale the objects??
User avatar
tirpider
Lance Corporal
Posts: 97
Joined: Fri Nov 25, 2011 3:58 pm

Re: TRAN section in msh

Post by tirpider »

I've been goofing around with hex-editing these msh files for a couple of years. TRAN is one of the earliest chunks to be sorted out, but I have yet to see anyone use/manipulate it effectively via hex-editing. Like you have discovered, weird scaling shows up, especially when you try rotations.

My solution has been to actually move all the verts instead of messing with TRAN. And if I need a rotation, I import with ZETools or give up. Both "solutions" go beyond what I would call hex-editing and don't solve the troubles with TRAN.

I suspect there is some confusion about the order of the fields, but haven't experimented with them. (welp, I guess not.) I hope someone can illuminate this, cause I want(need) to know as well.

If it helps, here are my notes on MSH structure:
http://www.swbfgamers.com/index.php?topic=3905.0

And here are Ande's:
http://www.ande.pytalhost.eu/reorganized_msh_tables.htm

In the case where Ande and I have different information, his is most likely more accurate. (I haven't updated in a very long time.)
Last edited by tirpider on Mon Dec 09, 2013 2:51 pm, edited 1 time in total.
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: TRAN section in msh

Post by AceMastermind »

This is from the source code:

XSI2MSHExporter\XSI3\Libraries\MSHParser\MSHBlockModel.cpp

Code: Select all

	StartBlock(file, 'TRAN');
		WriteData(file,&m_fScaleX,sizeof(float));
		WriteData(file,&m_fScaleY,sizeof(float));
		WriteData(file,&m_fScaleZ,sizeof(float));
		WriteData(file,&m_fQuatRotX,sizeof(float));
		WriteData(file,&m_fQuatRotY,sizeof(float));
		WriteData(file,&m_fQuatRotZ,sizeof(float));
		WriteData(file,&m_fQuatRotW,sizeof(float));
		WriteData(file,&m_fTransX,sizeof(float));
		WriteData(file,&m_fTransY,sizeof(float));
		WriteData(file,&m_fTransZ,sizeof(float));
	EndBlock(file);
RepSharpshooter's order is not accurate in comparison to the source. We'll need to update his information if it is to remain an FAQ thread. *done*
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: TRAN section in msh

Post by Anakin »

mh ok thank you.

i gave up to rotate. it's really wired. But i wanted to scale a chunk up. That worked fine for me at the Msh Viewer, but ingame it's not scaled up. Someone an idea??
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: TRAN section in msh

Post by AQT »

The only thing I have been able to get working properly with the TRAN chunk is translation, but I don't have a systematic way of doing it other than guessing and checking.

You have the 12 bytes in a row, where the first four refer to the x-axis, the second four refer to the y-axis, and the last four refer to the z-axis. But only the last two in each of the fours do the translating. So something like:
00 00 00 00 00 00 00 00 00 00 00 00
The first value in each of these twos translates the object in big intervals, while the second value does small intervals. From what I've seen, you can't use the second value properly until the first value is "right" (i.e. guess and check the first value until the object starts moving.) Once you find this value, also guess and check the second value until the object starts moving. Not very efficient, but it gets the job done.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: TRAN section in msh

Post by Anakin »

Thank you very much for this. What about the scaling?? Why does it work in mah viewer and not ingame?? Is there a special .option file i need?
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: TRAN section in msh

Post by AceMastermind »

No need to punish yourself, ANDEWEGET's MSH Suite can save you the time trying to figure this stuff out. He even wrote it to show Transform rotation in Euler angles so you can actually visualize your modifications.

forums/viewtopic.php?f=36&t=28451
https://github.com/Schlechtwetterfront/mshsuite
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: TRAN section in msh

Post by Anakin »

NICE :D

I forget this topic. I think i'll have a closer look at it. It' written in python. I think i'll have to look at python, too. ;) Since now i only programed in assambler, c, c++, matlab and a little bit java.
Post Reply