LoginSignup
0
0

More than 5 years have passed since last update.

unity > Quaternionの値(x,y,z,w)をCubeに適用する

Last updated at Posted at 2016-07-02
動作確認
Unity 5.3.5-f1 on OS X El Capitan

Quaternionの値(x,y,z,w)をCubeに対して設定する方法の整理。

  1. Cubeを作成
    • Name:Cube
    • Scale > X:3 とした
  2. Main CameraにScriptを設定
    • QuatCS.cs

以下コード

QuatCS.cs
using UnityEngine;
using System.Collections;

public class QuatCS : MonoBehaviour {

    void Start () {
        GameObject cube = GameObject.Find("Cube");
        Quaternion qtn = new Quaternion (0.04f, 0.37f, 0.17f, 0.91f);
        cube.transform.eulerAngles = qtn.eulerAngles;   
    }

    void Update () {
    }
}

結果

qiita.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0