本文整理汇总了C#中UnityEngine.Quaternion.SetEulerAngles方法的典型用法代码示例。如果您正苦于以下问题:C# Quaternion.SetEulerAngles方法的具体用法?C# Quaternion.SetEulerAngles怎么用?C# Quaternion.SetEulerAngles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Quaternion
的用法示例。
在下文中一共展示了Quaternion.SetEulerAngles方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Actors.Player>();
startRotation = new Quaternion(0, 0, 0, 1);
endRotation = new Quaternion(0, 0, 0, 1);
startRotation.SetEulerAngles(0, 0, 0);
endRotation.SetEulerAngles(0, 1, 0);
}
示例2: Start
void Start () {
thisHandlePivot = this.transform.parent.gameObject;
eulerEnd = (negative) ? -3.14f : 3.14f;
start = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
stop = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
// lastKnown = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
start.SetEulerAngles(0.0f, 0.0f, 0.0f);
stop.SetEulerAngles(0.0f, 0.0f, eulerEnd);
}
示例3: Start
// Use this for initialization
void Start()
{
// Angle0 = new Vector3(0,0,0);
// Angle90 = new Vector3(0.5f * Mathf.PI,0.0f,0.0f);
// Angle180 = new Vector3(180,0,0);
// Angle270 = new Vector3(270,0,0);
startingAngle = new Quaternion(0.0f,0.0f,0.0f,1.0f);
targetAngle = new Quaternion(0.0f,0.0f,0.0f,1.0f);
startingAngle.SetEulerAngles(0.0f,0.0f,0.0f);
targetAngle.SetEulerAngles(0.5f * Mathf.PI,0.0f,0.0f);
}
示例4: AsyncGenerateData
public void AsyncGenerateData()
{
if (queuedPoints == null)
{
queuedPoints = new List<Vector3>();
Quaternion quat = new Quaternion();
int rotationCounter = 0;
float rotationStepSize = 10;
for (float j = 2; j < 30; j *= 1.02f)
{
for (float f = 0 + rotationCounter; f < 360 + rotationCounter; f += rotationStepSize)
{
quat.SetEulerAngles(new Vector3(0, f, 0));
AsyncQueueCount++;
queuedPoints.Add(origin + (quat * Vector3.forward * j));
//DebugOutput.Shout("BASDASD");
}
rotationStepSize *= 0.983f;
//rotationCounter++;
}
}
TerrainGenerator tgen = new TerrainGenerator(Mathf.Pow(2, worldSize));
int queuedPos = AsyncQueuePlacement;
int stepsize = 100;
while ((queuedPos < (AsyncQueuePlacement + stepsize)) && queuedPos < queuedPoints.Count)
{
pendingData.Add(new SurveyDataPoint(queuedPoints[queuedPos], tgen.GeneratePointValueDouble(queuedPoints[queuedPos])));
queuedPos++;
}
AsyncQueuePlacement += stepsize;
}
示例5: findFacingProjectionPlane
public static void findFacingProjectionPlane(Entity e, GameObject go)
{
Vector3 position = new Vector3(0.0f, 0.0f, 0.0f);
Quaternion rotation = new Quaternion();
rotation.SetEulerAngles(0.0f, 0.0f, 0.0f);
Vector3 scale = new Vector3(1.0f, 1.0f, 1.0f);
bool facing = false;
Vector3[] rect = new Vector3[4];
rect[2] = new Vector3(-100.0f, -100.0f, 0.0f);
rect[3] = new Vector3(100.0f, 100.0f, 0.0f);
rect[1] = new Vector3(100.0f, -100.0f, 0.0f);
rect[0] = new Vector3(-100.0f, 100.0f, 0.0f);
float x = e.boundingBoxD * 0.5f;
float y = e.boundingBoxH * 0.5f;
float z = e.boundingBoxW * 0.5f;
rect[2] = new Vector3(-x, -y, z);
rect[3] = new Vector3(x, y, z);
rect[1] = new Vector3(x, -y, z);
rect[0] = new Vector3(-x, y, z);
Debug.Log("WH");
facing = isFacing(rect[0], rect[1], rect[2]);
if (!facing)
{
x = e.boundingBoxD * 0.5f;
y = e.boundingBoxW * 0.5f;
z = e.boundingBoxH * 0.5f;
rect[2] = new Vector3(-x, z, -y);
rect[3] = new Vector3(x, z, y);
rect[1] = new Vector3(x, z, -y);
rect[0] = new Vector3(-x, z, y);
Debug.Log("WD");
facing = isFacing(rect[0], rect[1], rect[2]);
if (!facing)
{
x = e.boundingBoxH * 0.5f;
y = e.boundingBoxW * 0.5f;
z = e.boundingBoxD * 0.5f;
//x = e.boundingBoxH * 0.5f;
//y = e.boundingBoxD * 0.5f;
//z = e.boundingBoxW * 0.5f;
rect[2] = new Vector3(z, -x, -y);
rect[3] = new Vector3(z, x, y);
rect[1] = new Vector3(z, x, -y);
rect[0] = new Vector3(z, -x, y);
Debug.Log("HD");
facing = isFacing(rect[0], rect[1], rect[2]);
if (!facing)
{
Debug.Log("shite");
}
}
}
go.transform.position = position;
go.transform.rotation = rotation;
go.transform.localScale = scale;
Mesh mesh = go.GetComponent<MeshFilter>().mesh;
Vector3[] vertices = new Vector3[4];
Debug.Log(mesh.vertices[0]);
Debug.Log(mesh.vertices[1]);
Debug.Log(mesh.vertices[2]);
Debug.Log(mesh.vertices[3]);
for (int i = 0; i < vertices.Length; i++)
{
vertices[i] = (e.center + rect[i]) * PersistantSettings.Instance.Scale;
Debug.Log(e.center + rect[i]);
}
mesh.vertices = vertices;
mesh.RecalculateBounds();
}
示例6: findBiggestProjectionPlane
//initialize with bounding box or rect extents
//should be a singleton so that it can be accessed by the proxy reps when querying the drawing state
//update when boundingbox of dataset changes
public static void findBiggestProjectionPlane(Entity e, GameObject go)
{
Vector3 position = new Vector3(0.0f, 0.0f, 0.0f);
Quaternion rotation = new Quaternion();
rotation.SetEulerAngles(0.0f, 0.0f, 0.0f);
Vector3 scale = new Vector3(1.0f, 1.0f, 1.0f);
Vector3[] rect = new Vector3[4];
rect[0] = new Vector3(-100.0f, -100.0f, 0.0f);
rect[1] = new Vector3(100.0f, 100.0f, 0.0f);
rect[2] = new Vector3(100.0f, -100.0f, 0.0f);
rect[3] = new Vector3(-100.0f, 100.0f, 0.0f);
if (e.boundingBoxW >= e.boundingBoxD && e.boundingBoxH >= e.boundingBoxD)
{
/*position += new Vector3(0.0f, 0.0f, e.boundingBoxD * 0.5f);
rotation.SetEulerAngles(0.0f, 0.0f, 0.0f);
scale = new Vector3(e.boundingBoxW, e.boundingBoxH, e.boundingBoxD);*/
float x = e.boundingBoxD * 0.5f;
float y = e.boundingBoxH * 0.5f;
float z = e.boundingBoxW * 0.5f;
rect[0] = new Vector3(-x, -y, z);
rect[1] = new Vector3(x, y, z);
rect[2] = new Vector3(x, -y, z);
rect[3] = new Vector3(-x, y, z);
Debug.Log("WH");
}
else if (e.boundingBoxW >= e.boundingBoxH && e.boundingBoxD >= e.boundingBoxH)
{
/*position += new Vector3(0.0f, e.boundingBoxH * 0.5f, 0.0f);
rotation.SetEulerAngles(90.0f, 90.0f, 0.0f);
scale = new Vector3(e.boundingBoxW, e.boundingBoxD, e.boundingBoxH);*/
float x = e.boundingBoxD * 0.5f;
float y = e.boundingBoxW * 0.5f;
float z = e.boundingBoxH * 0.5f;
rect[0] = new Vector3(-x, z, -y);
rect[1] = new Vector3(x, z, y);
rect[2] = new Vector3(x, z, -y);
rect[3] = new Vector3(-x, z, y);
Debug.Log("WD");
}
else if (e.boundingBoxH >= e.boundingBoxW && e.boundingBoxD >= e.boundingBoxW)
{
/*position += new Vector3(e.boundingBoxW * 0.5f, 0.0f, 0.0f);
rotation.SetEulerAngles(0.0f, 90.0f, 0.0f);
scale = new Vector3(e.boundingBoxH, e.boundingBoxD, e.boundingBoxW);*/
float x = e.boundingBoxH * 0.5f;
float y = e.boundingBoxW * 0.5f;
float z = e.boundingBoxD * 0.5f;
rect[0] = new Vector3(z, -x, -y);
rect[1] = new Vector3(z, x, y);
rect[2] = new Vector3(z, x, -y);
rect[3] = new Vector3(z, -x, y);
Debug.Log("HD");
}
go.transform.position = position;
go.transform.rotation = rotation;
go.transform.localScale = scale;
Mesh mesh = go.GetComponent<MeshFilter>().mesh;
Vector3[] vertices = new Vector3[4];
Debug.Log(mesh.vertices[0]);
Debug.Log(mesh.vertices[1]);
Debug.Log(mesh.vertices[2]);
Debug.Log(mesh.vertices[3]);
for (int i = 0; i < vertices.Length; i++)
{
vertices[i] = (e.center + rect[i]) * PersistantSettings.Instance.Scale;
Debug.Log(e.center + rect[i]);
}
mesh.vertices = vertices;
mesh.RecalculateBounds();
}