Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 16th, 2012  |  syntax: None  |  size: 0.44 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Vector3 playerPos = mapTarget.position;                    
  2.                     Vector3 objectPos = pair.Key.position;
  3.                     playerPos.y = objectPos.y = 0f;
  4.  
  5.                     Vector3 direction = playerPos - objectPos;
  6.                     float angle = Mathf.Atan2( direction.x, direction.z ) * Mathf.Rad2Deg;
  7.                     pair.Value.rotation = Quaternion.AngleAxis( -angle, Vector3.up ) * compassMeshObject.rotation;