#Offscreen indicators using a Physics Shape

1 messages · Page 1 of 1 (latest)

tacit portal
#

I'm building offscreen indicators (i.e unit goes offscreen -> put a widget on the edge of screen that points to it).

I wanted to experiment with using a Physics Shape component on the offscreen entity so that I can do raycasts against it to check for clicks / mouseovers / pan to unit etc.

I can successfully place the entity in world space that corresponds to the screen edge point I want it to be at, but the collider size doesn't scale with my camera zoom (as expected).

I'm syncing a GO that has a canvas+image to the correct position to successfully display my indicator, but I wanted to manage the interactions using entities physics.

Is it worth trying to change the collider size to correspond to the camera's orthographic size when the player zooms? Is there another way to make the collider "constant screen space size"?

Or is this whole idea just bad?

Note: I know generally the answer might be "don't use entities for UI yet", but I'm curious if there's an entities-based solution here.