Skip to content

Instantly share code, notes, and snippets.

@jrenner
Created April 29, 2014 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrenner/11402525 to your computer and use it in GitHub Desktop.
Save jrenner/11402525 to your computer and use it in GitHub Desktop.
Vector3 forwardInRest = Vector3.Z; // object's front is facing Z
Vector3 target = tmp.set(Input.worldMouse); // object should face mouse
q.setFromCross(forwardInRest, target.sub(pos).nor());
gameObj.transform.set(q);
gameObj.transform.setTranslation(pos);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment