ドキュメント

Unity Engine

Unity Engine

WorldToLocal

Transforms a point from the world space to the local space of the element.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

WorldToLocal(VisualElement, Vector2)

Transforms a point from the world space to the local space of the element.
public static Vector2 WorldToLocal(this VisualElement ele, Vector2 p)

Parameters

The element to use as a reference for the local space.

The point to transform, in world space.

Returns

Type

Description

Vector2A point in the local space of the element.

Remarks

This element needs to be attached to a panel and must have a valid VisualElement.layout. Otherwise, this method might return invalid results.

WorldToLocal(VisualElement, Rect)

Transforms a rectangle from the world space to the local space of the element.
public static Rect WorldToLocal(this VisualElement ele, Rect r)

Parameters

The element to use as a reference for the local space.

The rectangle to transform, in world space.

Returns

Type

Description

RectA rectangle in the local space of the element.

Remarks

This element needs to be attached to a panel and must receive a valid VisualElement.layout. Otherwise, this method may return invalid results.