c-d-a / io_export_qmap

.map exporter for Blender
GNU General Public License v3.0
84 stars 18 forks source link

How to export info_player_start ? #14

Open motorsep opened 1 year ago

motorsep commented 1 year ago

I attached a simple scene I've been working on. Geo exports fine, but I am wondering how can I export info_player_start with the map. This setup is basically to aid visualization of the size of the entity and the direction it's facing.

The expected output:

{ "classname" "info_player_start" << default, but would be nice to change it in Blender because it can vary "name" "info_player_start_1" << Entity's name (default) "angle" "90.000000" << get this from parent cube rotation (yaw) "origin" "-108 -82 11" << get this from the world location of the Empty }

test_cityblock1a.zip

c-d-a commented 1 year ago

Right, it doesn't work for D3 currently. It's exporting "angles" (Q1/Q3 convention for multi axis rotation), while D3 needs a "rotation" matrix. I still don't have the time to fix the script, but in the meantime: "rotation" is already implemented for spotlights, you can just copy the three lines to the handling of empties.
Edit: actually, seems like some point entities (func_static) use "rotation" while others (info_player_start) ignore it? Is there some consistent logic, or just special cases all the way? See, this is why this isn't a 5-second fix.

As for your blend file: first, you want to set the object name to the desired classname, e.g. "info_player_start" or "info_player_start.001" (dot rather than underscore, Blender's convention). I don't think the entity;s "name" actually matters (DR will just make one on opening the map).
Your arrow-shaped empty is pointing with its Z forward, that's going to put it on its side on export. If you use a camera instead of an empty, it will be exported as you'd intuitively expect. Or switch the empty to multi-axis display shape, +X is forward.
emp

motorsep commented 1 year ago

Thanks for suggestions

Edit: actually, seems like some point entities (func_static) use "rotation" while others (info_player_start) ignore it? Is there some consistent logic, or just special cases all the way? See, this is why this isn't a 5-second fix.

Well, for entities like monsters and player (and maybe something else that is a special case) it's going to be "angle" which is yaw. That's because normally it's the only way you are going to orient those entities on the map. In DarkRadiant I can't even rotate player around ant axis, but "yaw". I can rotate NPC however I want to and it will get "rotation" key vs "angle", but in-game it will spawn upright.

Here is an excerpt from Doom 3 engine code:

// get the rotation matrix in either full form, or single angle form if( !args->GetMatrix( "rotation", "1 0 0 0 1 0 0 0 1", renderEntity->axis ) ) { angle = args->GetFloat( "angle" ); if( angle != 0.0f ) { renderEntity->axis = idAngles( 0.0f, angle, 0.0f ).ToMat3(); } else { renderEntity->axis.Identity(); } }

So it can be either, by design.