Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: puddlepouncer on March 18, 2021, 06:21:42 AM

Title: WorldSpace to Screen Space - Camera
Post by: puddlepouncer 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.
 

Title: Re: WorldSpace to Screen Space - Camera
Post by: Leecm 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.

(https://i.ibb.co/s3T7qQr/Set-UICamera.png)
Title: Re: WorldSpace to Screen Space - Camera
Post by: djaydino 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