UI Element move in relation to LP's rotation in the workspace

Hello! I have been thinking about this question for days and decided to come to the devforum for help.

I wanted to know how to make an attitude indicator. Here is an example.

I wanted to make that line in the middle move in relation to the player’s rotation. How would I go about doing this? This basically means that the line will go up or down, left or right based on how the player is moving. I have made the speed and altitude indicator however I cannot figure out how to do this and there are no articles on the devforum. Thanks!

To go into more detail, an attitude indicator is a gyroscopic instrument [or electronic] that is used in most/all planes.

1 Like

What you could do is map its x rotation to the domain of the players inverse cosine to world space (basically the angle between the players look vector and some arbitrary look vector relative to world). To map it to that i’d recommend my Math++ module Well to be honest the domain is already -pi to pi so u could just abstract from the linear interpolation formula. For the turning i’d get its z rotation and do the same thing but instead of mapping the alpha of our range to the position i’d instead map alpha to a domain of -45 to 45. Tell me if you got any further questions

And let’s say if we wanted to map that towards a model, so it measures the models rotation, would that be any easier or would it be the same process?

If you think about it all a look vector is is some unit vector with rotation relative to the object. All you need to do is make some invisible part and have it orientate parallel to the plane

2 Likes

Great, thank you!

fillerfillerfillerfillerfiller

Heads up, a look vector doesn’t have rotation (vectors don’t have rotation), it’s just positioned in a way relative to an object.

1 Like

Well one could make the argument that a look vector NEEDS to be derived from rotation and position. After all we generate vectors from points by getting the difference between the tail and the head.