Version: 5.4
public Vector3 normal ;

説明

レイがヒットしたサーフェスの法線

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Transform gunObj; void Update() { if (Input.GetMouseButton(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Vector3 incomingVec = hit.point - gunObj.position; Vector3 reflectVec = Vector3.Reflect(incomingVec, hit.normal); Debug.DrawLine(gunObj.position, hit.point, Color.red); Debug.DrawRay(hit.point, reflectVec, Color.green); } } } }