Last active
October 11, 2018 00:48
-
-
Save aidiary/800c0efba3a0ed3a2701 to your computer and use it in GitHub Desktop.
キューブを回転させる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
// X軸、Y軸、Z軸を中心とした1秒あたりの回転速度 | |
// Time.deltaTimeをかけること! | |
var speedX : float = 30.0; | |
var speedY : float = 40.0; | |
var speedZ : float = 50.0; | |
function Update () { | |
// 前回のUpdate()の呼び出しからの経過時間を返す | |
var d = Time.deltaTime; | |
Debug.Log(d); | |
// このスクリプトを割り当てたオブジェクトを回転 | |
// 回転の軸はオブジェクトのローカル座標(Space.Self)に基づく | |
transform.Rotate(speedX * d, speedY * d, speedZ * d, Space.Self); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment