Version: 2022.1

描述

将 Vector4 转换为 Vector3

An implicit conversion of a Vector4 to a Vector3. The Vector4.w is discarded.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Create and display a Vector4. Vector4 vector4;

vector4 = new Vector4(1.0f, 2.0f, 3.0f, 4.0f); Debug.Log("Vector4: " + vector4);

// Convert the Vector4 into a Vector3. Vector3 vector3; vector3 = vector4;

// The 4.0f is not copied into the Vector3. // Show (1.0f, 2.0f, 3.0f). Debug.Log("Vector3: " + vector3); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961