Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHIP:FACING:PITCH supplying wrong values #664

Closed
dcrockwell opened this issue Mar 12, 2015 · 3 comments
Closed

SHIP:FACING:PITCH supplying wrong values #664

dcrockwell opened this issue Mar 12, 2015 · 3 comments

Comments

@dcrockwell
Copy link

When using SHIP:FACING:PITCH, I expect the value to change with the pitch of the ship. Instead, the YAW changes while the PITCH changes less than a degree.

Currently, I can find no way to get the current pitch value of a vessel so that it can be fed into HEADING() so as to change the heading but not the pitch.

Is there any way to do this that you know of?

@Dunbaratu
Copy link
Member

And once again the bad terminology chosen in the early days of the mod before we took it over, to use the words "pitch", "yaw", and "roll" in a situation where it's wrong, rears its ugly head. I'm beginning to wonder if backward compatibility isn't worth breaking here because of how utterly wrong the terms are and how often that causes questions like this.

@dcrockwell , the terminology is massively misleading. When you see SHIP:FACING:PITCH, you'd assume it was the pitch of the ship versus the horizon. It isn't. It's the Euler rotation angle around the universe's X axis that was used to rotate the ship from the default transform into the one it's in now. The actual XYZ axes of the universe are complex and messy, but what matters is that they have no relationship at all to the ship's own facing, and that they are what the terms pitch,yaw, and roll are really talking about, despite the broken terminology.

To get the pitch relative to the horizon, you can try getting the angle between SHIP:FACING:VEC and
SHIP:UP, using the VANG function: It should be 90 degrees when aimed at horizon, or less when aimed up from the horizon, or more when aimed down from the horizon. This formula should work:
set p to 90 - VANG(ship:facing:vec, ship:up). // p is now the pitch you're looking for

@dcrockwell
Copy link
Author

Thank you very much for your reply! I understand much better now, and your example completely unblocks my project. Cheers!

@LupusTheCanine
Copy link

I'd suggest adding something like ship:relative:pitch/yaw/roll/hdg, ship:global:(whatever),ship:relvelocity:(whatever) for velocity in ship's reference frame, and ship:bodyvelocity:(whatever) for velocity in spherical reference frame of body. (whatever)-I don't have idea how to call these. Won't break old codes, will simplify new ones, maybe ad some redundant variables but backward compatibility will be kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants