playMaker

Author Topic: Moving towards in screen coordinates  (Read 691 times)

DB23089

  • Playmaker Newbie
  • *
  • Posts: 2
Moving towards in screen coordinates
« on: April 21, 2021, 07:12:09 AM »
Hello to everyone,
I am working on missile lock system. Want i want to do is when raycasting detects object that UI element (image of lock system) move to 3d object and stays until rocket detroy object even if object is moving. I want to do that in 2d coordinates that image is always visible to camera and does not go in depth in forward axis. I have screen coordinates of both objects just dont know how to translate image over time. So far i try tween actions,Vector2 move towards and nothing works as expected. Any hints if I am missing something obvius?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Moving towards in screen coordinates
« Reply #1 on: April 21, 2021, 11:20:31 AM »
Hi.
if its ui (canvas)
You probably want to use 'Get Position' (3d object) 'Word to Screen Point' and 'Rect Transform Set Local Position'

DB23089

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Moving towards in screen coordinates
« Reply #2 on: April 21, 2021, 03:37:37 PM »
Thank you,i managed that part but i want that when target is recognized this image in Canvas comes slowly from corner towards the target. What action should i use with this obtained previous screen coordinates? I try so far Vector2 Move towards,translate position,tween position and Move Towards. Nothing works as expected.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Moving towards in screen coordinates
« Reply #3 on: April 22, 2021, 07:27:03 AM »
Hi.
Maybe 'Tween UI Position' can help there :)