Class Ray
Represents a three dimensional line based on a point in space and a direction.
Inheritance
Implements
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class Ray : ValueType, IEquatable<Ray>, IFormattable
Constructors
Ray(Vector3, Vector3)
Initializes a new instance of the Ray struct.
Declaration
public Ray(Vector3 position, Vector3 direction)
Parameters
Fields
Direction
The normalized direction in which the ray points.
Declaration
public Vector3 Direction
Field Value
Identity
Identity ray (at zero origin pointing forwards).
Declaration
public static readonly Ray Identity
Field Value
Position
The position in three dimensional space where the ray starts.
Declaration
public Vector3 Position
Field Value
Properties
Default
Methods
Equals(Ray)
Determines whether the specified Vector4 is equal to this instance.
Declaration
public bool Equals(Ray value)
Parameters
Returns
System.
|
Equals(ref Ray)
Determines whether the specified Vector4 is equal to this instance.
Declaration
public bool Equals(ref Ray value)
Parameters
Returns
System.
|
Equals(Object)
Determines whether the specified System.
Declaration
public override bool Equals(object value)
Parameters
System. The System. |
Returns
System.
|
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
System. A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
GetPickRay(Single, Single, ref Viewport, ref Matrix)
Calculates a world space ray from 2d screen coordinates.
Declaration
public static Ray GetPickRay(float x, float y, ref Viewport viewport, ref Matrix vp)
Parameters
System. The X coordinate on 2d screen. |
System. The Y coordinate on 2d screen. |
Viewport
viewport
The screen viewport. |
Matrix
vp
The View*Projection matrix. |
Returns
Ray
The resulting ray. |
GetPoint(Single)
Gets a point at distance long ray.
Declaration
public Vector3 GetPoint(float distance)
Parameters
System. The distance from ray origin. |
Returns
Vector3
The calculated point. |
Intersects(BoundingBox)
Determines if there is an intersection between the current object and a Bounding
Declaration
public bool Intersects(BoundingBox box)
Parameters
Bounding The box to test. |
Returns
System. Whether the two objects intersected. |
Intersects(ref BoundingBox)
Determines if there is an intersection between the current object and a Bounding
Declaration
public bool Intersects(ref BoundingBox box)
Parameters
Bounding The box to test. |
Returns
System. Whether the two objects intersected. |
Intersects(ref BoundingBox, out Vector3)
Determines if there is an intersection between the current object and a Bounding
Declaration
public bool Intersects(ref BoundingBox box, out Vector3 point)
Parameters
Bounding The box to test. |
Vector3
point
When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
System. Whether the two objects intersected. |
Intersects(ref BoundingBox, out Single)
Determines if there is an intersection between the current object and a Bounding
Declaration
public bool Intersects(ref BoundingBox box, out float distance)
Parameters
Bounding The box to test. |
System. When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
System. Whether the two objects intersected. |
Intersects(BoundingSphere)
Determines if there is an intersection between the current object and a Bounding
Declaration
public bool Intersects(BoundingSphere sphere)
Parameters
Bounding The sphere to test. |
Returns
System. Whether the two objects intersected. |
Intersects(ref BoundingSphere)
Determines if there is an intersection between the current object and a Bounding
Declaration
public bool Intersects(ref BoundingSphere sphere)
Parameters
Bounding The sphere to test. |
Returns
System. Whether the two objects intersected. |
Intersects(ref BoundingSphere, out Vector3)
Determines if there is an intersection between the current object and a Bounding
Declaration
public bool Intersects(ref BoundingSphere sphere, out Vector3 point)
Parameters
Bounding The sphere to test. |
Vector3
point
When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
System. Whether the two objects intersected. |
Intersects(ref BoundingSphere, out Single)
Determines if there is an intersection between the current object and a Bounding
Declaration
public bool Intersects(ref BoundingSphere sphere, out float distance)
Parameters
Bounding The sphere to test. |
System. When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
System. Whether the two objects intersected. |
Intersects(ref Plane)
Determines if there is an intersection between the current object and a Plane.
Declaration
public bool Intersects(ref Plane plane)
Parameters
Plane
plane
The plane to test |
Returns
System. Whether the two objects intersected. |
Intersects(ref Plane, out Vector3)
Determines if there is an intersection between the current object and a Plane.
Declaration
public bool Intersects(ref Plane plane, out Vector3 point)
Parameters
Plane
plane
The plane to test. |
Vector3
point
When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
System. Whether the two objects intersected. |
Intersects(ref Plane, out Single)
Determines if there is an intersection between the current object and a Plane.
Declaration
public bool Intersects(ref Plane plane, out float distance)
Parameters
Plane
plane
The plane to test. |
System. When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
System. Whether the two objects intersected. |
Intersects(ref Ray)
Determines if there is an intersection between the current object and a Ray.
Declaration
public bool Intersects(ref Ray ray)
Parameters
Ray
ray
The ray to test. |
Returns
System. Whether the two objects intersected. |
Intersects(ref Ray, out Vector3)
Determines if there is an intersection between the current object and a Ray.
Declaration
public bool Intersects(ref Ray ray, out Vector3 point)
Parameters
Ray
ray
The ray to test. |
Vector3
point
When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
System. Whether the two objects intersected. |
Intersects(ref Vector3)
Determines if there is an intersection between the current object and a point.
Declaration
public bool Intersects(ref Vector3 point)
Parameters
Vector3
point
The point to test. |
Returns
System. Whether the two objects intersected. |
Intersects(ref Vector3, ref Vector3, ref Vector3)
Determines if there is an intersection between the current object and a triangle.
Declaration
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
Parameters
Vector3
vertex1
The first vertex of the triangle to test. |
Vector3
vertex2
The second vertex of the triangle to test. |
Vector3
vertex3
The third vertex of the triangle to test. |
Returns
System. Whether the two objects intersected. |
Intersects(ref Vector3, ref Vector3, ref Vector3, out Vector3)
Determines if there is an intersection between the current object and a triangle.
Declaration
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out Vector3 point)
Parameters
Vector3
vertex1
The first vertex of the triangle to test. |
Vector3
vertex2
The second vertex of the triangle to test. |
Vector3
vertex3
The third vertex of the triangle to test. |
Vector3
point
When the method completes, contains the point of intersection, or Zero if there was no intersection. |
Returns
System. Whether the two objects intersected. |
Intersects(ref Vector3, ref Vector3, ref Vector3, out Single)
Determines if there is an intersection between the current object and a triangle.
Declaration
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out float distance)
Parameters
Vector3
vertex1
The first vertex of the triangle to test. |
Vector3
vertex2
The second vertex of the triangle to test. |
Vector3
vertex3
The third vertex of the triangle to test. |
System. When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
System. Whether the two objects intersected. |
ToString()
Returns a System.
Declaration
public override string ToString()
Returns
System. A System. |
ToString(IFormatProvider)
Returns a System.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
System. The format provider. |
Returns
System. A System. |
ToString(String)
Returns a System.
Declaration
public string ToString(string format)
Parameters
System. The format. |
Returns
System. A System. |
ToString(String, IFormatProvider)
Returns a System.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
System. The format. |
System. The format provider. |
Returns
System. A System. |
Operators
Equality(Ray, Ray)
Tests for equality between two objects.
Declaration
public static bool operator ==(Ray left, Ray right)
Parameters
Returns
System.
|
Inequality(Ray, Ray)
Tests for inequality between two objects.
Declaration
public static bool operator !=(Ray left, Ray right)
Parameters
Returns
System.
|