Class SoftBodySegment
- Namespace
- Jitter2.SoftBodies
- Assembly
- Jitter2.dll
A capsule-shaped collision segment spanning two soft-body vertices. Chains of segments can be used to build ropes and cables.
public class SoftBodySegment : SoftBodyShape, IDynamicTreeProxy, IPartitionedSetIndex, IUpdatableBoundingBox, ISupportFeature, ISupportMappable, IRayCastable, IAngularSweepTestable, ISweepTestable, IDistanceTestable, IDebugDrawable
- Inheritance
-
SoftBodySegment
- Implements
- Inherited Members
Remarks
Contacts are applied to the vertex closest to the contact point (see GetClosest(in JVector)), so segments should be kept short, about twice the Radius.
Constructors
SoftBodySegment(SoftBody, RigidBody, RigidBody)
Initializes a new segment between two vertices.
public SoftBodySegment(SoftBody body, RigidBody v1, RigidBody v2)
Parameters
bodySoftBodyThe soft body owning this segment.
v1RigidBodyThe first vertex.
v2RigidBodyThe second vertex.
Properties
Radius
Gets or sets the radius of the capsule.
public float Radius { get; set; }
Property Value
Velocity
Gets the velocity of the entity, used for bounding box expansion.
public override JVector Velocity { get; }
Property Value
Vertex1
Gets the first vertex of the segment.
public RigidBody Vertex1 { get; }
Property Value
Vertex2
Gets the second vertex of the segment.
public RigidBody Vertex2 { get; }
Property Value
Methods
GetCenter(out JVector)
Returns a point inside the shape. It does not need to be the center of mass.
public override void GetCenter(out JVector point)
Parameters
pointJVectorAn interior point in local space.
GetClosest(in JVector)
Gets the rigid body closest to the specified position.
public override RigidBody GetClosest(in JVector pos)
Parameters
posJVectorThe position in world coordinates.
Returns
- RigidBody
The closest rigid body (vertex) of this shape.
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)
Parameters
directionJVectorThe search direction in local space. Does not need to be normalized.
resultJVectorThe point on the shape's surface furthest along
direction.
UpdateWorldBoundingBox(float)
Recomputes the world-space bounding box.
public override void UpdateWorldBoundingBox(float dt = 0)
Parameters
dtfloatThe timestep for velocity-based expansion. Default is zero.