Version: 2018.2

Transform.InverseTransformDirection

Switch to Manual
public Vector3 InverseTransformDirection (Vector3 direction);

Description

Преобразовывает direction (направление) из глобальной в локальную систему координат. Противоположно Transform.TransformDirection.

Эта операция не зависит от масштабирования.

You should use Transform.InverseTransformPoint if the vector represents a position in space rather than a direction.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // transform the world forward into local space: Vector3 relative; relative = transform.InverseTransformDirection(Vector3.forward); Debug.Log(relative); } }

public Vector3 InverseTransformDirection (float x, float y, float z);

Description

Преобразует направление по x, y, z из мировой в локальную систему координат. Противоположно Transform.TransformDirection.

Эта операция не зависит от масштабирования.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // transform the world forward into local space: Vector3 relative; relative = transform.InverseTransformDirection(Vector3.forward); Debug.Log(relative); } }