Table of Contents

Class SoftBodyShape

Namespace
Jitter2.SoftBodies
Assembly
Jitter2.dll

Abstract base class for shapes used in soft body simulations.

public abstract class SoftBodyShape : Shape, IDynamicTreeProxy, IPartitionedSetIndex, IUpdatableBoundingBox, ISupportMappable, IRayCastable, ISweepTestable, IDistanceTestable
Inheritance
SoftBodyShape
Implements
Derived
Inherited Members

Properties

SoftBody

Gets the soft body instance this shape belongs to.

public SoftBody SoftBody { get; }

Property Value

SoftBody

Methods

Distance<T>(in T, in JQuaternion, in JVector, out JVector, out JVector, out JVector, out float)

Finds the closest points between this object and the query shape.

public override bool Distance<T>(in T support, in JQuaternion orientation, in JVector position, out JVector pointA, out JVector pointB, out JVector normal, out float distance) where T : ISupportMappable

Parameters

support T

The query shape.

orientation JQuaternion

The query shape orientation in world space.

position JVector

The query shape position in world space.

pointA JVector

Closest point on the query shape in world space. Undefined when the shapes overlap.

pointB JVector

Closest point on this object in world space. Undefined when the shapes overlap.

normal JVector

Unit direction from the query shape toward this object, or Zero when the shapes overlap. Do not use this to test whether a result was found.

distance float

The separation distance between the shapes. Zero when overlapping.

Returns

bool

true if the shapes are separated; false if they overlap.

Type Parameters

T

The query support-map type.

GetClosest(in JVector)

Gets the rigid body closest to the specified position.

public abstract RigidBody GetClosest(in JVector pos)

Parameters

pos JVector

The position in world coordinates.

Returns

RigidBody

The closest rigid body (vertex) of this shape.

RayCast(in JVector, in JVector, out JVector, out float)

Performs a ray cast against this object.

public override bool RayCast(in JVector origin, in JVector direction, out JVector normal, out float lambda)

Parameters

origin JVector

The starting point of the ray.

direction JVector

The direction of the ray. Does not need to be normalized.

normal JVector

The surface normal at the intersection point, or Zero if the ray origin is inside the object. Use the return value, not this parameter, to test whether a hit occurred.

lambda float

The distance along the ray to the intersection: hitPoint = origin + lambda * direction. Zero when the ray origin is inside the object.

Returns

bool

true if the ray intersects with the object; otherwise, false. Also returns true when the ray origin is inside the object, with lambda set to zero and normal set to Zero.

Sweep<T>(in T, in JQuaternion, in JVector, in JVector, out JVector, out JVector, out JVector, out float)

Performs a sweep test against this object.

public override bool Sweep<T>(in T support, in JQuaternion orientation, in JVector position, in JVector sweep, out JVector pointA, out JVector pointB, out JVector normal, out float lambda) where T : ISupportMappable

Parameters

support T

The query shape.

orientation JQuaternion

The query shape orientation in world space.

position JVector

The query shape position in world space.

sweep JVector

The query shape translation in world space.

pointA JVector

Collision point on the query shape in world space at the sweep origin. Undefined when the shapes already overlap.

pointB JVector

Collision point on this object in world space at the sweep origin. Undefined when the shapes already overlap.

normal JVector

Collision normal in world space, or Zero if the shapes already overlap. Use the return value to determine whether a hit occurred; do not rely on this being non-zero.

lambda float

The time of impact expressed in units of sweep. Zero if the shapes already overlap.

Returns

bool

true if the query shape hits or already overlaps this object; otherwise, false.

Type Parameters

T

The query support-map type.