当前位置: 首页>>代码示例>>C#>>正文


C# Quaternion.SetEulerAngles方法代码示例

本文整理汇总了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);
 }
开发者ID:Dawnwoodgames,项目名称:LotsOfTowers,代码行数:8,代码来源:TutorialDoorTrigger.cs

示例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);
 }
开发者ID:TheFragen,项目名称:P5_UnityProject,代码行数:9,代码来源:HandleInteraction.cs

示例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);
 }
开发者ID:g-bunny,项目名称:InterPlay,代码行数:12,代码来源:FrameUnitRotation.cs

示例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;
    }
开发者ID:pbostrm,项目名称:ceres,代码行数:38,代码来源:SurveyData.cs

示例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();
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:87,代码来源:ProjectionPlane.cs

示例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();
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:85,代码来源:ProjectionPlane.cs


注:本文中的UnityEngine.Quaternion.SetEulerAngles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。