You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
joint is added to the physics motor (root.post...)
When removing this joint, phy.remove(joint.name) --- the routine in Motor will do nothing, as phy.byName() returns null - however the joint is kept alive in the worker.
This causes many nasty bugs - for example
if you remove any object part of the joint, the worker (physx at least) will later crash on stepItems (when attempting to call getGlobalPose() on the existing joints, but their objects do not exist.
if joints belong to instancemeshes and instances are removed, joints are kept alive and sometimes point to the wrong instance, resulting in funny joints between incorrect objects in the scene
After that crash, worker must be restarted.
My temp fix:
// RLP: SEND ALWAYS TO MOTOR to remove non-exising joints
static remove(name, direct = false, physicsType = "joint") {
if (name.constructor === Array) return Motor.removes(name, direct);
let b = Motor.byName(name);
if (b) {
// remove on three side
if (b.extraRemove) b.extraRemove();
ITEM_LIBRARY[b.type].clear(b);
}
const objectType = b ? b.type : physicsType;
// remove on physics side
if (objectType) root.post({ m: "remove", o: { name: name, type: objectType } }, null, direct);
}
So when removing joints, I call remove(jointName, false, "joint") - or remove(jointName, false) as physicsType is set to joint. It's not the most elegant but it works well.
The text was updated successfully, but these errors were encountered:
So if you add a joint with "debug" turned off
When removing this joint,
phy.remove(joint.name)
--- the routine in Motor will do nothing, as phy.byName() returns null - however the joint is kept alive in the worker.This causes many nasty bugs - for example
if you remove any object part of the joint, the worker (physx at least) will later crash on stepItems (when attempting to call getGlobalPose() on the existing joints, but their objects do not exist.
if joints belong to instancemeshes and instances are removed, joints are kept alive and sometimes point to the wrong instance, resulting in funny joints between incorrect objects in the scene
After that crash, worker must be restarted.
My temp fix:
So when removing joints, I call remove(jointName, false, "joint") - or remove(jointName, false) as physicsType is set to joint. It's not the most elegant but it works well.
The text was updated successfully, but these errors were encountered: