How do i get a consistent axis rotation value?
Splitting the Camera Transform, and then it's rotation value gives 3 outputs. The idea was to create a HUD compass (like PUBG, Horizon) using the Y value.
The problem is that this value changes if you aim up and down with the camera. (-180/180 in horizontal orientation, -130/130 in up/down orientation)
How do I keep this value consistent to -180/180?
-
I finally figured it out!!
https://indreams.me/element/oHsfmbATcxy
The basic idea is... actually rather complicated:
- Use the camera transform to emit an object at the same position and orientation as the current view.
- On that object, have 2 tags: one at the centre and one further out. Subtract the outer position from the centre position to get the "direction" it is facing.
- Use a second object with a "look at" rotator and tell it what direction to face, *after* splitting and recombining to only use the X and Z component of the direction. This means it won't try to look up/down.
- Use an angle sensor on that object to find out what Y rotation it has.
But it's all in that linked logic piece anyway. Hope this helps. ^^ -
I think I linked the wrong one... here's the actual compass chip: https://indreams.me/element/ocqSiVTvTbX
Please sign in to leave a comment.