playMaker

Author Topic: WorldSpace to Screen Space - Camera  (Read 804 times)

puddlepouncer

  • Playmaker Newbie
  • *
  • Posts: 18
WorldSpace to Screen Space - Camera
« on: March 18, 2021, 06:21:42 AM »
Hi!

I'm trying to figure out how to convert a UI-object from worldspace to screen space when using the screen space -camera mode. Using Screen space overlay works great with the World To ScreenPoint action but I can't figure out the next steps for converting it to Screen space - camera. I was thinking rect transform world to screen point action would be useful but draw a blank there.

To clarfiy the purpose I want to place an health-bar over a character.
 


Leecm

  • Playmaker Newbie
  • *
  • Posts: 1
Re: WorldSpace to Screen Space - Camera
« Reply #1 on: October 15, 2023, 05:19:36 PM »
I solved the problem and am posting it here in case anyone needs help with this in the future.
To put it simply, if you use the Canvas mode of Screen Space Camera, the screen coordinates need to be recalculated to have the correct effect.
To make it easier for everyone to understand, here is how I made it without using Custom Actions. I will show it to you through screenshots.



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: WorldSpace to Screen Space - Camera
« Reply #2 on: October 16, 2023, 06:14:48 AM »
Hi.
I believe that there should be a dedicated action "Set Camera Ortho Size"

You should always try to avoid using Get/Set Properties actions