ドキュメント

Unity Engine

Unity Engine

PlaceObject(Vector2, out Vector3, out Vector3)

Casts a ray against the loaded scenes and returns the nearest intersected point on a collider.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

PlaceObject(Vector2, Vector3, Vector3)

public static bool PlaceObject(Vector2 guiPosition, out Vector3 position, out Vector3 normal)

Parameters

guiPosition

The GUI position in the SceneView. You can pass mousePosition to this parameter in most cases.

position

Returns the nearest intersected point to a ray cast from the mouse position into the scene.

normal

Returns the normal of the nearest intersected point to a ray cast from the mouse position into the scene.

Returns

Type

Description

boolReturns true if the raycast intersected something in the scene; otherwise, false.

Remarks

Use this method to match the behavior of drag and drop in the SceneView.
HandleUtility.PlaceObject also queries any delegates registered to HandleUtility.placeObjectCustomPasses when determining the nearest point.