-
|
Hi there! Quick question, does Jolt support soft body collision with other soft bodies? There is no demo for such thing and on my side the soft bodies go thru each other :( I currently have the following filtering / body setup which lets me create collisions between static / dynamic objects (soft bodies also have the PhysicsLayer.MOVING layer type): export enum PhysicsLayer {
MOVING,
NON_MOVING,
KINEMATIC,
RIG,
};
...
public setupCollisionFiltering(settings: JoltSettings): void {
let objectFilter: ObjectLayerPairFilterTable = new Jolt.ObjectLayerPairFilterTable(NUM_OBJECT_LAYERS);
objectFilter.EnableCollision(PhysicsLayer.NON_MOVING, PhysicsLayer.MOVING);
objectFilter.EnableCollision(PhysicsLayer.MOVING, PhysicsLayer.MOVING);
const BP_LAYER_NON_MOVING = new Jolt.BroadPhaseLayer(0);
const BP_LAYER_MOVING = new Jolt.BroadPhaseLayer(1);
const NUM_BROAD_PHASE_LAYERS = 2;
let bpInterface: BroadPhaseLayerInterfaceTable = new Jolt.BroadPhaseLayerInterfaceTable(
NUM_OBJECT_LAYERS, NUM_BROAD_PHASE_LAYERS);
bpInterface.MapObjectToBroadPhaseLayer(PhysicsLayer.NON_MOVING, BP_LAYER_NON_MOVING);
bpInterface.MapObjectToBroadPhaseLayer(PhysicsLayer.MOVING, BP_LAYER_MOVING);
settings.mObjectLayerPairFilter = objectFilter;
settings.mBroadPhaseLayerInterface = bpInterface;
settings.mObjectVsBroadPhaseLayerFilter = new Jolt.ObjectVsBroadPhaseLayerFilterTable(
settings.mBroadPhaseLayerInterface,
NUM_BROAD_PHASE_LAYERS,
settings.mObjectLayerPairFilter,
NUM_OBJECT_LAYERS);
};and then create bodies this way: if (isSoftBody) {
creationSettings = new Jolt.SoftBodyCreationSettings(shape, wPosition, wRotation, layer);
else {
creationSettings = new Jolt.BodyCreationSettings(
shape, wPosition, wRotation, motionType, layer) as BodyCreationSettings;
}
// set collision group
if (group !== -1 || subGroup !== -1) {
creationSettings.mCollisionGroup = this.engine.collisionFilteringManager.standardCollisionGroup;
if (group !== -1) {
creationSettings.mCollisionGroup.SetGroupID(group);
}
if (subGroup !== undefined) {
creationSettings.mCollisionGroup.SetSubGroupID(subGroup);
}
}
// create new body
const body: Body = isSoftBody
? this._bodyInterface.CreateSoftBody(creationSettings as any)
: this._bodyInterface.CreateBody(creationSettings as any);
// ... |
Beta Was this translation helpful? Give feedback.
Answered by
jrouwe
Oct 16, 2025
Replies: 1 comment 3 replies
-
|
No, see jrouwe/JoltPhysics#789 |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
alienself
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No, see jrouwe/JoltPhysics#789