Matrix4x4 guiMatrix = GUI.matrix; // засекаем текущую матрицу, чтобы не крутить вообще все элементы.
GUIUtility.RotateAroundPivot(rotationRingAngle, new Vector2(pos.x, Screen.height - pos.y));
GUI.DrawTexture(rect, selectedTexture); // тут можно использовать любой элемент GUI - кнопку, бокс, что угодно.
GUI.matrix = guiMatrix; // восстанавливаем GUI матрицу.
var angleRotationx;
var angleRotationy;
var angleRotationz;
function Update () {
angleRotationy = transform.eulerAngles.y;
angleRotationx = transform.eulerAngles.x;
angleRotationz = transform.eulerAngles.z;
transform.Rotate(angleRotationx,angleRotationy,angleRotationz);
}
var angleRotationx;
var angleRotationy;
var angleRotationz;
function Update () {
angleRotationx = transform.rotation.x-transform.eulerAngles.x;
angleRotationy = transform.rotation.y-transform.eulerAngles.y;
angleRotationz = transform.rotation.z-transform.eulerAngles.z;
transform.Rotate(angleRotationx,angleRotationy,angleRotationz);
}
using UnityEngine;
using System.Collections;
public class Compas : MonoBehaviour {
public Texture2D comp_s;
public Transform pers;
void OnGUI ()
{
float rotate = pers.transform.eulerAngles.y;
GUIUtility.RotateAroundPivot (rotate, new Vector2(Screen.width - 64, 128));
GUI.Label (new Rect(Screen.width - 128, 64, 128, 128), comp_s);
}
}
using UnityEngine;
using System.Collections;
public class Compas : MonoBehaviour {
public Texture2D comp_s;
public Transform pers;
void OnGUI ()
{
float rotate = pers.transform.eulerAngles.y;
/*
GUIUtility.RotateAroundPivot (rotate, new Vector2(Screen.width - 64, 128));
GUI.Label (new Rect(Screen.width - 128, 64, 128, 128), comp_s);
*/
GUIUtility.RotateAroundPivot (rotate, new Vector2(160, 160));
GUI.DrawTexture(new Rect(32.0f, 32.0f, 256.0f, 256.0f),
comp_s, ScaleMode.StretchToFill, true, 0);
}
}
Сейчас этот форум просматривают: Yandex [Bot] и гости: 10