|
Hello. I've been working on a 2d game, but I've run into a problem with a standard function. 1. How do you make a object rotate to face the cursor? and 2. How do you make the crosshair follow the mouse. Thanks.
(comments are locked)
|
|
Considering you have a GUI Crosshair texture, here's the code you use.
var position : Rect; function Start() { position = Rect( ( Screen.width - crosshairTexture.width ) / 2, ( Screen.height - crosshairTexture.height ) / 2, crosshairTexture.width, crosshairTexture.height ); } function OnGUI()
{
GUI.DrawTexture(position, crosshairTexture); ...and that's how. about that 2d rotator thing... I absolutely have no idea. PS make sure to have the GUI Crosshair set into the script. remember, the script is in the camera!
(comments are locked)
|
|
Try this answer. It should solve the 2D Rotation issue. link dont work anymore btw.
Apr 18 at 06:07 PM
cowasockytommy
(comments are locked)
|
