32 lines
989 B
C#
Raw Normal View History

2025-04-01 16:16:45 +08:00
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2007-2020 , Inc. All Rights Reserved.
//
////////////////////////////////////////////////////////////////////////////////
using UnityEngine;
namespace GCSeries.Core.Extensions
{
public static class RayExtensions
{
////////////////////////////////////////////////////////////////////////
// Public Extension Methods
////////////////////////////////////////////////////////////////////////
/// <summary>
/// Converts a Ray to a Pose based on its origin and direction
/// vectors.
/// </summary>
///
/// <returns>
/// Pose initialized based on the origin and direction of the Ray.
/// </returns>
public static Pose ToPose(this Ray ray, Vector3 up)
{
return new Pose(
ray.origin, Quaternion.LookRotation(ray.direction, up));
}
}
}