Table of Contents

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

body SoftBody

The soft body owning this segment.

v1 RigidBody

The first vertex.

v2 RigidBody

The second vertex.

Properties

Radius

Gets or sets the radius of the capsule.

public float Radius { get; set; }

Property Value

float

Velocity

Gets the velocity of the entity, used for bounding box expansion.

public override JVector Velocity { get; }

Property Value

JVector

Vertex1

Gets the first vertex of the segment.

public RigidBody Vertex1 { get; }

Property Value

RigidBody

Vertex2

Gets the second vertex of the segment.

public RigidBody Vertex2 { get; }

Property Value

RigidBody

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

point JVector

An 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

pos JVector

The 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

direction JVector

The search direction in local space. Does not need to be normalized.

result JVector

The 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

dt float

The timestep for velocity-based expansion. Default is zero.