Class SphereProximity
Defines a proximity in the shape of a sphere.
public class SphereProximity : ISphereProximity, INearestPointProximity, IAttachableProximity<IAttachedSphereProximity>, IProximity, IShapeVolume, ICloneable, IFormattable
- Inheritance
-
SphereProximity
- Implements
-
IShapeVolume
- Inherited Members
- Extension Methods
Constructors
SphereProximity(ISphereProximity)
Create a sphere from another ISphereProximity.
public SphereProximity(ISphereProximity other)
Parameters
otherISphereProximity
Exceptions
- ArgumentException
Position or radius isn't finite (not NaN or Infinity).
SphereProximity(in BoundingSphere)
Create a sphere from a UnityEngine.BoundingSphere.
public SphereProximity(in BoundingSphere sphere)
Parameters
sphereBoundingSphere
Exceptions
- ArgumentException
Position or radius isn't finite (not NaN or Infinity).
SphereProximity(in Vector3, float)
Create a sphere from a position and radius.
public SphereProximity(in Vector3 position, float radius)
Parameters
positionVector3radiusfloat
Exceptions
- ArgumentException
Position or radius isn't finite (not NaN or Infinity).
Properties
Sphere
Sphere used for detection.
public BoundingSphere Sphere { get; }
Property Value
- BoundingSphere
worldBounds
Axis-aligned bounds of the sphere.
public Bounds worldBounds { get; }
Property Value
- Bounds
Methods
Clone()
Creates a new object that is a copy of the current instance.
public object Clone()
Returns
- object
A new object that is a copy of this instance.
TestPoint(in Vector2)
Check if a position is within the proximity while ignoring Y position.
public bool TestPoint(in Vector2 position)
Parameters
positionVector2
Returns
TestPoint(in Vector3)
Check if a position is within the proximity.
public bool TestPoint(in Vector3 position)
Parameters
positionVector3
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToString(string?, IFormatProvider?)
Formats the value of the current instance using the specified format.
public string ToString(string? format, IFormatProvider? formatProvider)
Parameters
formatstringThe format to use.
-or-
A null reference (Nothingin Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProviderIFormatProviderThe provider to use to format the value.
-or-
A null reference (Nothingin Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.