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

ContactPoint.normal

Declaration

public Vector3 normal;

Описание

Нормальная точка контакта.

В следующем примере будет нарисована линия, представляющая каждую нормаль от столкновения. Каждая линия будет нарисована в представлении Scene.

using UnityEngine;

public class Example : MonoBehaviour { void OnCollisionEnter(Collision other) { // Print how many points are colliding with this transform Debug.Log("Points colliding: " + other.contacts.Length);

// Print the normal of the first point in the collision. Debug.Log("Normal of the first point: " + other.contacts[0].normal);

// Draw a different colored ray for every normal in the collision foreach (var item in other.contacts) { Debug.DrawRay(item.point, item.normal * 100, Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f), 10f); } } }