docs.unity3d.com
    目次を表示する/隠す

    Rotate ノード

    説明

    入力 UV の値を、入力 Center で定義される基準点を中心として、入力 Rotation の量だけ回転させます。パラメーター Unit で回転角の単位を選択できます。

    ポート

    Name Direction タイプ バインディング 説明
    UV 入力 Vector 2 UV 入力 UV 値
    Center 入力 Vector 2 なし 回転の中心点
    Rotation 入力 Vector 1 なし 適用する回転の量
    Out 出力 Vector 2 なし 出力 UV 値

    制御

    Name タイプ オプション 説明
    Unit ドロップダウン Radians, Degrees 入力 Rotation の単位を切り替えます。

    生成されるコードの例

    以下のサンプルコードは、Unit モード毎に、このノードの出力の一例を示したものです。

    Radians

    void Unity_Rotate_Radians_float(float2 UV, float2 Center, float Rotation, out float2 Out)
    {
        UV -= Center;
        float s = sin(Rotation);
        float c = cos(Rotation);
        float2x2 rMatrix = float2x2(c, -s, s, c);
        rMatrix *= 0.5;
        rMatrix += 0.5;
        rMatrix = rMatrix * 2 - 1;
        UV.xy = mul(UV.xy, rMatrix);
        UV += Center;
        Out = UV;
    }
    

    Degrees

    void Unity_Rotate_Degrees_float(float2 UV, float2 Center, float Rotation, out float2 Out)
    {
        Rotation = Rotation * (3.1415926f/180.0f);
        UV -= Center;
        float s = sin(Rotation);
        float c = cos(Rotation);
        float2x2 rMatrix = float2x2(c, -s, s, c);
        rMatrix *= 0.5;
        rMatrix += 0.5;
        rMatrix = rMatrix * 2 - 1;
        UV.xy = mul(UV.xy, rMatrix);
        UV += Center;
        Out = UV;
    }
    
    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)