Author Topic: 2d UI waypoint  (Read 3351 times)

beforethelight

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
2d UI waypoint
« on: November 23, 2012, 03:08:15 AM »
I am just wondering if there is a function for making a sprite look at a object.  I have a 2d lander game and I just want to have a arrow in the ui that points to the landing zone.  everything i try ends up working with the z axis pointing at the object, where for a 2d I need the y to point at the object.  Thanks.

beforethelight

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: 2d UI waypoint
« Reply #1 on: November 24, 2012, 12:48:54 AM »
Ok so not how I had hoped to fix this but I added a game object that is offset by the amount off target and made my arrow a child.  This is ok but I really dont like what it.  Is there any way to have a waypoint marker move around the edge of the screen pointing in the direction of the landing zone?   Any info would be great. Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 2d UI waypoint
« Reply #2 on: November 24, 2012, 01:34:34 AM »
It's a math question rather than an NGUI question. Knowing that the sprite's normal orientation (rotation 0) makes it point up (assuming your sprite points up), figure out the angle between the 2D up vector and the 2D direction to your object (widgetPos2D - objectPos2D).