playMaker

Author Topic: Horizontal UGUI compass[SOLVED]  (Read 2186 times)

IIKII

  • Full Member
  • ***
  • Posts: 137
  • Lonely developer
    • Patreon
Horizontal UGUI compass[SOLVED]
« on: July 10, 2019, 10:06:22 PM »
Hi, anyone have any ideas or clues on how to make a horizontal ugui compass similar to those in skyrim or assassin creed? I only need it to display the north south east west and important waypoints.

thanks
« Last Edit: August 01, 2019, 04:29:19 AM by jeanfabre »
Support me on Patreon for free adventure games and development insights - https://www.patreon.com/koexstudio

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Horizontal UGUI compass
« Reply #1 on: July 11, 2019, 02:53:51 AM »
Hi,

 Do you have a video showing how it works so that I get the right ideas behind what you want to achieve? thanks :)

Bye,

 Jean

IIKII

  • Full Member
  • ***
  • Posts: 137
  • Lonely developer
    • Patreon
Re: Horizontal UGUI compass
« Reply #2 on: July 11, 2019, 09:45:37 AM »
Hi,

 Do you have a video showing how it works so that I get the right ideas behind what you want to achieve? thanks :)

Bye,

 Jean


Ah yes, here's a video from skyrim.

The top UI displaying the waypoints and cardinal points.

thanks :D
Support me on Patreon for free adventure games and development insights - https://www.patreon.com/koexstudio

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Horizontal UGUI compass
« Reply #3 on: July 12, 2019, 03:26:27 AM »
Hi,

 ok, This is doable.

- each of your gameobjects that should be visible in the compass, should get their signed angle between them and the camera x axis ( the screen plane). Signed angle actions are available on the ecosystem.

- then, you use that signed angle report it onto a linear scale, say your compass goes from -1 to 1, and you want to report object between -30 and 30 degrees.  You can use the custom action FloatRemap for this very easily.

so you have two distinct feature to implement. Start with one and work you way into this step by step.

Let me know how it goes.

 Bye,

 Jean
 

IIKII

  • Full Member
  • ***
  • Posts: 137
  • Lonely developer
    • Patreon
Re: Horizontal UGUI compass
« Reply #4 on: July 14, 2019, 06:49:02 AM »


I am using a ui image with the image cut at the 'S' and the repeat setting.

There's still something wrong with it, the compass ui isnt moving accurately. For example when it is going north, it went a different direction.

I tried a number of settings with the float base and end but none of them really is working perfectly.
Support me on Patreon for free adventure games and development insights - https://www.patreon.com/koexstudio

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Horizontal UGUI compass
« Reply #5 on: July 15, 2019, 04:23:59 AM »
Hi,

 Ok, that's slightly different, since you are not showing the Target object in front of you but only want the true north.

- take the y rotation of the your camera, this is a direct relation with the north. Let's assume that when y rotation is 0, this is north. this will do as a first step, then you'll want the world rotation, not the local rotation.

- remap this angle to translate the image of your compass.

Let me know how you progress on this.

Bye,

 Jean

IIKII

  • Full Member
  • ***
  • Posts: 137
  • Lonely developer
    • Patreon
Re: Horizontal UGUI compass
« Reply #6 on: July 17, 2019, 01:50:10 AM »
I managed to get it working with using y rotation so that's great.

But I tried working on the target based compass based on your first post and I am stuck.

"- then, you use that signed angle report it onto a linear scale, say your compass goes from -1 to 1, and you want to report object between -30 and 30 degrees.  You can use the custom action FloatRemap for this very easily."

So i got my signed angle from a cube that is my North but I wasn't sure on how to do the second step from above. And also unsure on how to set up my compass for this.
Support me on Patreon for free adventure games and development insights - https://www.patreon.com/koexstudio

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Horizontal UGUI compass
« Reply #7 on: July 17, 2019, 07:45:10 AM »
Hi,

- have you played with FloatRemap action yet?

- in your compass, one way is to add children and you set the anchor position in relative coordinates ( 0 is left, 1 is right, 0.5 is dead center), try this manually first, can you position a child of your compass ( acting as a marker for your target), and move it using the rec transform anchor?

- then you use float remap and the technic above to map the angle to the anchor.

Bye,

 Jean

Prestonh

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Horizontal UGUI compass
« Reply #8 on: August 01, 2019, 02:14:33 AM »
I was playing with this. There is a get sign angle to float from target (something something) on the eco system.   You plug in the player and a target, i used the middle of the map.  And remapped it from -180 to 180.     To a float of -.5 to .5.    Then set a semmless raw image UV X to the float.  Worked great.   To have objectives, also on it.   I overlapped the compass with another texture (like a icon),  which streches it out, them use the uv width to shrink it back to normal.   In my case a W of 7.   Then used that same action for the compass, but did player to objective as target,   Then remapped those to -.5. To 6.5 and set the UV. X on the icon.   Works good.