LoginSignup
0
0

More than 1 year has passed since last update.

【unity】x,y,zを数値入力すれば、ひたすら自動回転するオブジェクトであそぼう

Last updated at Posted at 2020-01-21

当記事の動画での解説はこちらから。
https://youtu.be/QExPYTRZb7o

Packageファイルは、BOOTHにて無料配布しています。
BOOTHへはこちらから

こんな感じに、x,y,zを数値入力することによって、
オブジェクトがひたすらグルグルまわります。

AutoRotObject.gif

b.png


スクリプトはこんなかんじ。

RotateCube.cs
using UnityEngine;
public class RotateCube : MonoBehaviour
{
    public float rotX;
    public float rotY;
    public float rotZ;
    void Update()
    {
        transform.Rotate(rotX, rotY, rotZ);
    }
}

すると、コンポーネントは下図のようになります。

20211006a02.png

下図のように値を入力してみます。

20211006a03.png

回っている様子
AutoRotObject.gif


ぜひ遊んでみてね!!

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