Class AACylinderProximity
Defines an 'axis-aligned' cylinder proximity.
public class AACylinderProximity : IAACylinderProximity, INearestPointProximity, IAttachableProximity<IAttachedAACylinderProximity>, IProximity, IShapeVolume, ICloneable, IFormattable
- Inheritance
-
AACylinderProximity
- Implements
-
IShapeVolume
- Inherited Members
- Extension Methods
Constructors
AACylinderProximity(in Vector2, float, float)
Create an axis-aligned cylinder on the Y axis.
public AACylinderProximity(in Vector2 center, float radius, float height = Infinity)
Parameters
centerVector2Center of the cylinder as (X, Z). Components must be finite.
radiusfloatRadius of the cylinder. Must be finite.
heightfloatHeight of the cylinder. Can be infinity or NaN (converts to infinity).
Exceptions
- ArgumentOutOfRangeException
Axis is not X, Y, or Z.
- ArgumentException
Radius or center is not finite.
AACylinderProximity(in Vector3, float, float, SnapAxis)
Create an axis-aligned cylinder.
public AACylinderProximity(in Vector3 center, float radius, float height, SnapAxis axis = SnapAxis.Y)
Parameters
centerVector3Center of the cylinder. Depending on the axis one component will be discarded if
heightisn't finite. Other components must be finite.radiusfloatRadius of the cylinder. Must be finite.
heightfloatHeight of the cylinder. Can be infinity or NaN (converts to infinity).
axisSnapAxisAxis to align to. Defaults to the Y axis. Must either be UnityEngine.SnapAxis.X, UnityEngine.SnapAxis.Y, or UnityEngine.SnapAxis.Z.
Exceptions
- ArgumentOutOfRangeException
Axis is not X, Y, or Z.
- ArgumentException
Radius or center is not finite.
Properties
Axis
The axis the cylinder is aligned to. Must be 'X', 'Y', or 'Z'.
public SnapAxis Axis { get; }
Property Value
- SnapAxis
Remarks
Defaults to 'Y'.
Center
Center position of the cylinder.
public Vector3 Center { get; }
Property Value
- Vector3
Height
Cylinder height.
public float Height { get; }
Property Value
Remarks
Can be PositiveInfinity.
Radius
Radius of the cylinder.
public float Radius { get; }
Property Value
worldBounds
Not necessarily cheap to calculate - probably best to cache.
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.