Scripts / TransportToFreezePosition() g_PlayerAngX problem

Author
Message
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 29th Jan 2017 19:52
i want when i press the e key to look at specific direction but the x angle instaid of 370 goes down to 85 in general every value i place beyon 85 the x value gues to 85.


Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2017 20:01 Edited at: 29th Jan 2017 20:02
Those aren't valid Euler angles so what you get would be pure guesswork.

X angle is pitch and you would expect +90 to be looking straight up and -90 straight down.
Y is yaw which you would expect to be -180 to +180
Z is roll so you would expect 180 to +180

Through experimentation I found that the gimbal lock positions in GG are on Y rotation!

i.e. the limits are actually:
X -180 to +180
Y -90 to +90
Z -180 to +180

(when I say 90 or 180 of course I mean 89.99999 and 179.99999 )

Euler angles are so damn difficult to work with I created a quaternion library before I pulled all my hair out btw.
Been there, done that, got all the T-Shirts!
PM
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 29th Jan 2017 21:09
How i can make it work?then?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2017 21:19
You just need to work out the correct angles to use,. just make sure you stay within the Euler limits if you want it to be predictable.

Might be a good idea to go read the Wikipedia page on Euler angles so you understand what they are and how they work.
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2017 21:20 Edited at: 29th Jan 2017 21:21
btw, step back and think a minute, what is an up/down angle of 370 degrees?
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Jan 2017 21:47
it's bugged for the x angle.
even using g_PlayerAngX, as soon as you look up any amount it will reset the value to 85 (or -85) i.e. looking at the ground but works fine when looking down.
haven't received a reply from lee on it yet.
i think we need to adjust the values ourselves as amen suggests to make sure they wrap correctly.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 29th Jan 2017 21:59
Quote: "it's bugged for the x angle."

Oh, nice to know, I was dealing with days ago, and I believe it's my fail.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2017 22:03
It's not bugged as such, it's just that when using Euler angles there has to be a gimbal lock point (or actually a number of them) so developers choose to limit angles to avoid the problem, in this case I think Lee used a limit of 85 degrees (which is sensible for an FPS engine).

I haven't had an occasion to look up more than 85 degrees myself so probably haven't hit this but when manipulating entities using quaternions (which have no gimbal lock issues) I haven't found any limits in the engine on SetRotation so it must just be a limit Lee chose for SetFreezeAngle.

@smallg, Did you hit this problem in your spaceship script?
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Jan 2017 10:44
No because I don't use the players x angle, I used the entity's instead and simply lock the players ability to look around.

its not just going above 85, it's anything above flat that causes it but only for the players returned value (I assume because the entities don't have the lock that you talk about).
I haven't tried to wrap the value manually yet but seeing as we know the values that it can be it should be pretty easy so know I know it's an expected result I'll just do that
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 30th Jan 2017 13:05
I got it
i restricted the player angleY


PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Feb 2017 00:20 Edited at: 1st Feb 2017 00:22
Try this!

(attach to a crate, use W&S to pitch, E&R to yaw and A&D to roll)

The funny wobble is because I couldn't figure out how to turn off the 'walking head-bob'.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM

Login to post a reply

Server time is: 2024-12-23 03:39:03
Your offset time is: 2024-12-23 03:39:03