|
[code=javascript]var Mid : Texture2D;
var mouse : Texture2D; //鼠标图片
var mousePs = Vector2.zero; //鼠标的位置
private var angle : float;
function Update () {
mousePs = Input.mousePosition;//获取鼠标位置
angle = 180 - Mathf.Atan2(mousePs.x - 250, Screen.height -mousePs.y - 250) * Mathf.Rad2Deg;//计算选择角度
}
function OnGUI () {
Screen.showCursor = false;
GUIUtility.RotateAroundPivot (angle, Vector2(250, 250));
GUI.DrawTexture(Rect(200,200,100,100),Mid);
GUIUtility.RotateAroundPivot (-angle, Vector2(250, 250));
GUI.DrawTexture(Rect(mousePs.x,Screen.height -mousePs.y,237,60),mouse);
}
[/code]
扔到相机上,预备二个texture拉到对应属性中
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|