1
NGUI 3 Support / Re: UISprite Viewport distance to pixel width
« on: October 22, 2014, 06:47:06 AM »
D'oh - thanks, seem like Screen space is all i wanted. Thank you! This solution is working (connecting two Points with a single line-sprite, attatch this to a sprite with pivot set do "down"):
- //Rotate towards Target;
- Quaternion newRotation = Quaternion.LookRotation(mTrans.position - target.position, Vector3.forward);
- newRotation.x = 0.0f;
- newRotation.y = 0.0f;
- mTrans.rotation = newRotation;
- //Set Length
- float dist = Vector3.Distance(nguicam.WorldToScreenPoint(mTrans.position),nguicam.WorldToScreenPoint(target.position));
- sprite.SetDimensions(width,(int)dist);
