Unity 6.3
0 онлайн 36 гостей 3 в системе
Вход

RaycastHit2D.point

Declaration

public Vector2 point;

Описание

Позиция в мировом пространстве, где фигура физического запроса пересекается с обнаруженной поверхностью Collider2D.

Дополнительные ресурсы: ,RaycastHit2D.normal, и ,RaycastHit2D.fraction,.

using UnityEngine;

public class ExampleClass : MonoBehaviour { public Vector2 direction;

void Update() { // Cast a ray in the direction specified in the inspector. RaycastHit2D hit = Physics2D.Raycast(transform.position, direction);

// If something was hit, draw a line from the start position to the point we intersected. if (hit) Debug.DrawLine(transform.position, hit.point, Color.yellow); } }