gongpha / gdQmapbsp

A simple plugin that loads Quake's MAP/BSP files into Godot 4 interactively
MIT License
42 stars 5 forks source link

Quake->Godot Coordinate Change #31

Open jitspoe opened 10 months ago

jitspoe commented 10 months ago

So this is more of a discussion than an issue, as I'm also working on a BSP importer and I'm a bit undecided on what to do with the X axis. Obviously, Z needs to become Y, as Z is up in Quake and Y is up in Godot. Originally, I was just going to keep X the same, but when I started working on entity angles, it made me wonder if it makes more sense to make +X into -Z, since +X is 0 rotation, and forward in Godot is -Z, so it just sort of works out. Qodot seems to make +X into +Z, which makes everything 180 degrees off. Looking at how you've handled it, it seems like you turn +X into -X? Vector3(-q.x, q.z, q.y) Curious what the reasoning behind that was.

gongpha commented 10 months ago

I've been using this conversion since 5-6 years ago. that was my first attempt at my parser for my old game engine (before Godot). IIRC, I used the X-axis as a forward direction like Quake. When I came to Godot, it seemed like the stuff was broken when I moved here. The workaround I remembered is negating the X-axis and rotating entities clockwise-counter 90 degrees. And yeah, It pretty much was a rough approach because there's no standard conversion about these as far as I found.

But when you start to discuss this topic. It makes me realize that the approach you suggested is interesting. Using X to -Z Vector3(-q.y, q.z, -q.x) instead of X to -X Vector3(-q.x, q.z, q.y) gave me the same result but not needed to add angles. It may fix other issues in my func_ implementations.