Vector3.operator *

Unity · Версия 2020.3 LTS · Scripting · Vector3

Vector3.operator *

public static Vector3 operator *(Vector3 a, float d);

Описание

Умножает вектор на число.

Умножает каждый компонент a на число d.

// сделать вектор вдвое длиннее: печатает (2.0,4.0,6.0)
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Example()
    {
        print(new Vector3(1.0f, 2.0f, 3.0f) * 2.0f);
    }
}

public static Vector3 operator *(float d, Vector3 a);

Описание

Умножает вектор на число.

Умножает каждый компонент a на число d.

// делаем вектор вдвое длиннее: печатает (2.0f, 4.0f, 6.0f)

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Example()
    {
        print(2.0f * new Vector3(1.0f, 2.0f, 3.0f));
    }
}

Обновлено 17 ноября 2026 г.