Class AttachedSphereProximity
A sphere attached to a transform. Scale and position are applied.
public class AttachedSphereProximity : IAttachedSphereProximity, ISphereProximity, INearestPointProximity, IAttachableProximity<IAttachedSphereProximity>, IAttachedProximity, IProximity, IShapeVolume, ICloneable, IFormattable
- Inheritance
-
AttachedSphereProximity
- Implements
-
IShapeVolume
- Inherited Members
- Extension Methods
Constructors
AttachedSphereProximity(Transform, ISphereProximity)
Create a sphere from another ISphereProximity attached to attachmentRoot.
public AttachedSphereProximity(Transform attachmentRoot, ISphereProximity sphere)
Parameters
attachmentRootTransformsphereISphereProximity
AttachedSphereProximity(Transform, in BoundingSphere)
Create a sphere from a UnityEngine.BoundingSphere.
public AttachedSphereProximity(Transform attachmentRoot, in BoundingSphere sphere)
Parameters
attachmentRootTransformsphereBoundingSphere
Exceptions
- ArgumentException
Position or radius isn't finite (not NaN or Infinity).
AttachedSphereProximity(Transform, in Vector3, float)
Create a sphere from a position and radius.
public AttachedSphereProximity(Transform attachmentRoot, in Vector3 position, float radius)
Parameters
attachmentRootTransformpositionVector3radiusfloat
Exceptions
- ArgumentException
Position or radius isn't finite (not NaN or Infinity).
Properties
AttachmentRoot
The transform this proximity is attached to.
public Transform? AttachmentRoot { get; }
Property Value
- Transform
Sphere
Sphere used for detection.
public BoundingSphere Sphere { get; }
Property Value
- BoundingSphere
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.