ScriptSpot

Forum topic · General Scripting

Help wanted - Maxscript for exporting transforms to unreal 4

By jpjapers · 2015-11-05

Description

Hi, Ive built a script based on the idea behind tom shannons unreal exporter. The problem i had was that his script wasnt assigning the meshes to the actors. I wrote a maxscript that exports the object names and transforms to a file and i then run this through an exe i wrote to create the placement script for use in ue4.

However when i paste my code into unreal, despite the coordinates being the same as they are in max, the objects are somewhat offset or rotated in the wrong direction. I wrote this for my own use but im more than willing to release it once its bug free id just appreciate help from someone familiar with maxscript and unreal to take a look and see if they can see anything im doing wrong. At the moment it brings in the models and assigns the correct meshes and transforms but they are a little bit off and weird.

Here is the export csv code


(
path = getSaveFileName caption:"CHOOSE OUTPUT PATH" filename:"Kitlayout" types:"Layout file"
file = createFile path 

for i=1 to selection.count do
(
print selection[i].name

rn = getUserProp selection[i] "Name"
if rn==undefined then rn=selection[i].name

s=selection[i]

zrot = in coordsys gimbal s.rotation.z_rotation 
xrot = in coordsys gimbal s.rotation.x_rotation 
yrot = in coordsys gimbal s.rotation.y_rotation 

format "%,%,%,%,%,%,%\n" rn s.position.x s.position.z s.position.y xrot yrot zrot to:file
)
CLOSE FILE
)

I also have the exe to troubleshoot and the code it outputs too if anyone is willing to help?

Thanks
Jack

Comments (1)

jpjapers · 2015-11-10

In the 6 days i waited i managed to fix it. It was an issue dut to the unreal coordinates system and the axis orientation discrepancy in max and unreal.