Struct Ray
Represents a ray with an origin and a direction in 3D space.
[DataContract]
public struct Ray : IEquatable<Ray>
- Implements
- Inherited Members
Constructors
Ray(Vector3, Vector3)
Create a Ray.
public Ray(Vector3 position, Vector3 direction)
Parameters
Fields
Direction
The direction of this Ray.
[DataMember]
public Vector3 Direction
Field Value
Position
The origin of this Ray.
[DataMember]
public Vector3 Position
Field Value
Methods
Deconstruct(out Vector3, out Vector3)
Deconstruction method for Ray.
public void Deconstruct(out Vector3 position, out Vector3 direction)
Parameters
positionVector3Receives the start position of the ray.
directionVector3Receives the direction of the ray.
Equals(Ray)
public bool Equals(Ray other)
Parameters
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
Returns
GetHashCode()
Get a hash code for this Ray.
public override int GetHashCode()
Returns
Intersects(BoundingBox)
Check if this Ray intersects the specified BoundingBox.
public float? Intersects(BoundingBox box)
Parameters
boxBoundingBoxThe BoundingBox to test for intersection.
Returns
- float?
The distance along the ray of the intersection ornullif this Ray does not intersect the BoundingBox.
Intersects(ref BoundingBox, out float?)
Check if this Ray intersects the specified BoundingBox.
public void Intersects(ref BoundingBox box, out float? result)
Parameters
boxBoundingBoxThe BoundingBox to test for intersection.
resultfloat?The distance along the ray of the intersection ornullif this Ray does not intersect the BoundingBox.
Intersects(BoundingSphere)
Check if this Ray intersects the specified BoundingSphere.
public float? Intersects(BoundingSphere sphere)
Parameters
sphereBoundingSphereThe BoundingBox to test for intersection.
Returns
- float?
The distance along the ray of the intersection ornullif this Ray does not intersect the BoundingSphere.
Intersects(ref BoundingSphere, out float?)
Check if this Ray intersects the specified BoundingSphere.
public void Intersects(ref BoundingSphere sphere, out float? result)
Parameters
sphereBoundingSphereThe BoundingBox to test for intersection.
resultfloat?The distance along the ray of the intersection ornullif this Ray does not intersect the BoundingSphere.
Intersects(Plane)
public float? Intersects(Plane plane)
Parameters
Returns
- float?
The distance along the ray of the intersection ornull
Intersects(ref Plane, out float?)
public void Intersects(ref Plane plane, out float? result)
Parameters
planePlaneThe Plane to test for intersection.
resultfloat?The distance along the ray of the intersection ornull
ToString()
public override string ToString()
Returns
Operators
operator ==(Ray, Ray)
Check if two rays are equal.
public static bool operator ==(Ray a, Ray b)
Parameters
Returns
- bool
trueif the two rays are equals,
falseif they are not.
operator !=(Ray, Ray)
Check if two rays are not equal.
public static bool operator !=(Ray a, Ray b)
Parameters
Returns
- bool
trueif the two rays are not equal,
falseif they are.