jitspoe / godot_bsp_importer

An importer addon to import Quake BSP files.
MIT License
102 stars 10 forks source link

add support for "angles" property #10

Open Skaruts opened 11 months ago

Skaruts commented 11 months ago

I'm not sure this is intentional or not, but currently the plugin doesn't check for the angles property when importing entities. Only angle and mangle are checked, but the former is just rotation around Z axis (vertical), while the latter is rotation around all axes, but in a different way from angles (pitch yaw roll vs yaw pitch roll).

I'm not being able to correctly rotate my entities using mangle. I don't suppose this has to do with using Valve format, but I could be wrong.

jitspoe commented 11 months ago

Ah, I guess I overlooked that. Didn't have anything with "angles" I was testing.

Man this is confusing.

“angles” is interpreted as “pitch yaw roll” (if the entity model is a Quake MDL, pitch is inverted)
“mangle” is interpreted as “yaw pitch roll” if the entity classnames begins with “light”, otherwise it’s a synonym for “angles”

So it needs to behave differently depending on the entity, but that might be kind of ... bleh for custom entities. Also, that list doesn't seem extensive because "mangle" pitch is inverted for the intermission as well.

More info from the Quake mapping discord (just for my own reference):

Roatation Cheat Sheet:
angles: 'Pitch Yaw Roll' (MAIN)
angle: Yaw (mostly), has entity specific hacks such as -1 for straight up, -2 for straight down
mangle: 'Pitch Roll Yaw' (mostly)
_sunlight_mangle: 'Yaw Pitch Roll' (yeesh)

Gotchas:
mangle is entity specific, some entities use this as additive velocity and/or direction or for other things. Check editor or fgd description.
mangle is 'Pitch Yaw Roll' if it is a mapobject_custom or misc_model.
mangle is 'Yaw Pitch Roll' on lights
angle is entity specific, not everything respects negative 1 or 2 for up and down.  Lights use it for spotlight cone angle.

All are degrees in range 0 to 360.
Pitch: Airplane nose up, airplane nose down.
Yaw: Compass heading.
0 is East
90 North
180 West
270 South
Roll: Tilt head side to side, barrel roll

Typically rotation of mangle or angle gets applied to angles in code, except for lights.
Skaruts commented 11 months ago

Might be worth making it consistent. :)

I personally don't even see the point of mangle. I can't see a reason why one would want to rotate an entity differently if it's a light, specifically, but I could be missing something.

I don't suppose we can safely use angle for spotlights, since TB will interpret it as the angle of rotation. The manual doesn't mention any exceptions to that. I don't see where angle would be useful though. A door wouldn't want to use angle, because it might not be a regular door. It might be a trapdoor, a drawbridge, or an aperture. There might be entities that could use angle, but I can't think of one.

Maybe it might be safer to leave angle for the user to interpret?

All that's left is angles. Just like the others, if an entity has the property angles, rotating it will update that property, so it's handy. It's what I was trying to use to rotate some torches.

jitspoe commented 11 months ago

I would love for them to be consistent, but the problem is, they aren't in Quake, and what is displayed in Trenchbroom is (presumably) how the angles in Quake work, which is different per entity. If people import existing maps or use the default entities in Quake, it should probably import them in the same manner. 😖