Class CylinderShape
Represents a cylinder shape defined by a height and radius.
public class CylinderShape : RigidBodyShape, IDynamicTreeProxy, IPartitionedSetIndex, IUpdatableBoundingBox, ISupportMappable, IRayCastable, ISweepTestable, IDistanceTestable, IDebugDrawable
- Inheritance
-
CylinderShape
- Implements
- Inherited Members
Constructors
CylinderShape(float, float)
Initializes a new instance of the CylinderShape class, creating a cylinder shape with the specified height and radius. The symmetry axis of the cylinder is aligned along the y-axis.
public CylinderShape(float height, float radius)
Parameters
Exceptions
- ArgumentOutOfRangeException
Thrown when
heightorradiusis less than or equal to zero.
Properties
Height
Gets or sets the height of the cylinder.
public float Height { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
Thrown when
valueis less than or equal to zero.
Radius
Gets or sets the radius of the cylinder.
public float Radius { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
Thrown when
valueis less than or equal to zero.
Methods
CalculateBoundingBox(in JQuaternion, in JVector, out JBoundingBox)
public override void CalculateBoundingBox(in JQuaternion orientation, in JVector position, out JBoundingBox box)
Parameters
orientationJQuaternionpositionJVectorboxJBoundingBox
CalculateMassInertia(out JSymmetricMatrix, out JVector, out float)
Calculates the mass and inertia of the shape. Can be overridden by child classes to improve performance or accuracy. The default implementation relies on an approximation of the shape constructed using the support map function.
public override void CalculateMassInertia(out JSymmetricMatrix inertia, out JVector com, out float mass)
Parameters
inertiaJSymmetricMatrixcomJVectormassfloat
Remarks
The inertia tensor is computed relative to the coordinate system origin (0,0,0), not the center of mass.
DebugDrawLocal<TSink>(ref TSink, in DebugDrawSettings)
Appends debug triangles in the coordinate system used by SupportMap(in JVector, out JVector).
protected override void DebugDrawLocal<TSink>(ref TSink triangleSink, in DebugDrawSettings settings) where TSink : ISink<JTriangle>
Parameters
triangleSinkTSinkThe destination for generated triangles.
settingsDebugDrawSettingsThe visualization settings.
Type Parameters
TSink
Remarks
Override this method to supply custom surface geometry. Rigid-body and affine transforms are applied by the caller. Use outward-facing triangles for closed surfaces. Without an override, the shape is drawn as an approximate surface.
GetCenter(out JVector)
Computes a representative point within the convex hull, used as an initial search point in GJK-based algorithms.
public override void GetCenter(out JVector point)
Parameters
pointJVectorA point inside the convex hull.
SupportMap(in JVector, out JVector)
Computes the point on the shape that is furthest in the specified direction.
public override void SupportMap(in JVector direction, out JVector result)