Salk 374 Posted September 3, 2020 Hello! I have been fiddling with modding the game for quite some time but I am still inexperienced and not nearly knowledgeable enough so I am going to ask something that I believe would be useful to many others as well. Namely, how to find the right values when it comes to choose direction for creatures, placeables, doors and cameras. It seems to me that the game uses three different standards: 1) X Orientation and Y Orientation in some cases 2) X Quaternion and Y Quaternion in others 3) Bearing Is this correct? And what is the best way to correctly calculate those values having an initial angle? For 1 and 2, I have been using the invaluable Star Admiral's Utility Armband. 3 is not something I have read about anywhere. If I remember correctly, I have also read somewhere that different modules use different compass so that North in one of them can be East in another, adding to the confusion. Is this true? Cheers! Quote Share this post Link to post Share on other sites
DarthParametric 3,784 Posted September 3, 2020 14 minutes ago, Salk said: Is this correct? No. You are confounding 1 and 2. Both are quats, just stored differently. The game uses degrees, radians, and quats, depending on what specifically you are talking about. Broadly speaking, "facing", as used in scripting, is a cardinal (i.e. compass) direction and is specified in degrees. "Bearing", as used for placeables in the GIT, is specified in radians. "Orientation", as used for a number of things like cameras and creatures in the GIT, is expressed as two components of a quaternion. 1 Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted September 3, 2020 Doors and placeables in GIT files use the Bearing field, which is in radians except written as decimal. So the valid values are from 0 to 3.14159 or 0 to -3.14159. 0 is either north or east, depending on the module. Placeables spawned through scripts use rotation in degrees, with values from 0 to 180 or 0 to -180. Creatures in GIT files use the XOrientation and YOrientation fields, which are quaternions. Converting from radians or degrees is pretty straightforward and here's a random online calculator that can do it. Creatures spawned through scripts use rotation in degrees. Same as the above for placeables. Static cameras use the Orientation field, which is also a quaternion. I don't remember how these work because there are a lot of advantages to using animated camera models, one of which being that you don't have to mess around with quaternions. 1 Quote Share this post Link to post Share on other sites
DarthParametric 3,784 Posted September 3, 2020 It should be clarified that cameras actually use two values. A quat for the Z rotation (i.e. orientation) and degrees for "pitch", the X rotation (because in 3DS Max, cameras start off pointed straight down at the ground. As far as origin goes, values in GITs should always be derived from North as 0, whereas values in scripts take East as 0. Although from memory there are a couple of modules that don't use East as the origin, which can screw things up. 1 Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted September 3, 2020 Off the top of my head, end_m01aa, end_m01ab, danm14aa, and tat_m17ab are the odd ones out that I remember. And possibly 151HAR and 605DAN in KOTOR 2 since they were based on KOTOR 1 oddities. But I haven't investigated this weirdness much because it was easier to get in the habit of checking where north is. Edit: DarthParametric investigated it and apparently the direction of north is entirely based on the rotation system and not dependent on the area. The Endar Spire has some weirdness with the minimap, and maybe other areas do too, but that's all it is. I think I over the years got confused by the mismatch between the different rotation systems and chalked it up to the area on account of the weirdness with the Endar Spire. 1 Quote Share this post Link to post Share on other sites
Salk 374 Posted September 3, 2020 Well, thanks guys! Very informative and useful. Cheers! PS I have immediately made (good, hopefully) use of my new knowledge about placeables by changing the very odd direction/position of the footlocker in Uthar Wynn's room to a much more sensible one. It might be almost K1 CP material... Quote Share this post Link to post Share on other sites
Salk 374 Posted September 4, 2020 I have found a new place for the footlockers in Uthar Wynn's room but I have encountered a strange graphical glitch for one of the two boxes and I have no idea where it comes from. Perhaps looking at the image someone can take a guess? Quote Share this post Link to post Share on other sites
DarthParametric 3,784 Posted September 4, 2020 Your pic is too small and full of artefacts to see anything. ENHANCE! Quote Share this post Link to post Share on other sites
Salk 374 Posted September 4, 2020 I'm not sure whether I did a good job at enhancing/enlarging it but here it is: Some small parts of the footlocker comes out of the base. Quote Share this post Link to post Share on other sites
DarthParametric 3,784 Posted September 4, 2020 It's not the placeable. It's probably the crud overlay on the floor which floats a bit to eliminate Z-fighting. Make sure the height of the placeable is at least 0.15m and shuffle it to the right half a meter or so. 1 Quote Share this post Link to post Share on other sites