用户工具

站点工具


侧边栏

script:unityengine:classes:transform:transform.inversetransformdirection

Transform.InverseTransformDirection 反向变换方向

JavaScript ⇒ InverseTransformDirection(direction: Vector3): Vector3;
C# ⇒ Vector3 InverseTransformDirection(Vector3 direction);

Description 描述

Transforms a direction from world space to local space. The opposite of Transform.TransformDirection.

变换的方向从世界坐标转换到局部坐标。和Transform.TransformDirection相反。

This operation is unaffected by scale.

此操作不受缩放影响。

JavaScript:

	// transform the world forward into local space:
	private var relative : Vector3;
	relative = transform.InverseTransformDirection(Vector3.forward);
	Debug.Log(relative);

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    private Vector3 relative;
    void Example() {
        relative = transform.InverseTransformDirection(Vector3.forward);
        Debug.Log(relative);
    }
}

JavaScript ⇒ InverseTransformDirection(x: float, y: float, z: float): Vector3;
C# ⇒ Vector3 InverseTransformDirection(float x, float y, float z);

Description 描述

Transforms the direction x, y, z from world space to local space. The opposite of Transform.TransformDirection.

变换方向x, y, z 从世界坐标转换到局部坐标,和Transform.TransformDirection相反。

This operation is unaffected by scale.

此操作不受缩放影响。

JavaScript:

	// transform the world forward into local space:
	private var relative : Vector3;
	relative = transform.InverseTransformDirection(0, 0, 1);
	Debug.Log(relative);

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    private Vector3 relative;
    void Example() {
        relative = transform.InverseTransformDirection(0, 0, 1);
        Debug.Log(relative);
    }
}

Transform

script/unityengine/classes/transform/transform.inversetransformdirection.txt · 最后更改: 2016/08/02 05:37 (外部编辑)