playMaker

Author Topic: Offscreen Target Indicator  (Read 2652 times)

MarkD

  • Full Member
  • ***
  • Posts: 113
Offscreen Target Indicator
« on: April 30, 2016, 01:48:43 AM »
Hey guys,

I'm trying to put together an offscreen target indicator.  I'm sure you've seen those games where there's an NPC or an important thing happening just off screen and a marker will appear on the edge of your screen pointing the way you should go to find it?

I feel like there's probably an answer with the World to Screen Action, but so far it's not working for me.  Here's my test example:

A 3D cube placed in scene, off screen from the player.

On the cube I have an FSM that is:
Get Position of itself, every frame
World to Screen, every frame
Using the screen variables from "World to Screen", I'm applying those to a panel object on my canvas.

So far, that only puts the panel in the lower, left  hand corner of the screen and it never moves, regardless of the position values changing.

Anyone have ideas or other strategies I might try?

Thanks!

~Mark

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Offscreen Target Indicator
« Reply #1 on: April 30, 2016, 03:47:59 PM »
This is the state I use to track a crosshair- it might be useful to track on offscreen object


The game object var "DefaultTarget" would be the object you want to track-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

MarkD

  • Full Member
  • ***
  • Posts: 113
Re: Offscreen Target Indicator
« Reply #2 on: April 30, 2016, 09:38:12 PM »
Thanks (again) mdot.

That's pretty much my exact layout, though I was using x and y floats instead of Vector 3's.  I tried your approach exactly but it's still acting funky.

Here's my setup:

3 objects:
The player
The off-screen object
The GUI Panel

On the player, I've got this FSM


The Test Cube is just off screen to the south of the player.

The Panel is showing up generally in the lower right hand corner of the screen, but it IS moving around once I move far enough.

I want the panel to stay locked to the edge of the screen, but so far I don't see an easy way to limit it from moving all around the screen.

I'm thinking position might not be the way to go, but maybe there's something I can do with the pivots.  Though to be perfectly honest I don't know what half of the UI variables do so I'm just feeling around in the dark.

I'll keep experimenting, but if you or anyone else have an ideas I'd really appreciate it!

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Offscreen Target Indicator
« Reply #3 on: May 01, 2016, 12:03:55 AM »
Hmm yeh sounds like its an issue with the ugui object- this is how my image I'm positioning is setup


Is the pivot set to center on your object? That might be it- I've never tried positioning panels just images and text-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Smerf2

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Offscreen Target Indicator
« Reply #4 on: February 02, 2023, 08:04:07 AM »
I know this is an old topic, but how would one go about getting the UI to stay onscreen? like a pointer pointing in the direction of the object at the edge of the screen