Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private destroy () {
AmmoSharedBody.sharedBodesMap.delete(this.node.uuid);
(this.node as any) = null;
(this.wrappedWorld as any) = null;
const bodyStruct = this.bodyStruct;
Ammo.destroy(bodyStruct.body);
Ammo.destroy(bodyStruct.localInertia);
Ammo.destroy(bodyStruct.motionState);
Ammo.destroy(bodyStruct.rbInfo);
Ammo.destroy(bodyStruct.shape);
Ammo.destroy(bodyStruct.startTransform);
Ammo.destroy(bodyStruct.worldQuat);
const key0 = 'KEY' + bodyStruct.id;
delete AmmoInstance.bodyStructs[key0];
const ghostStruct = this.ghostStruct;
Ammo.destroy(ghostStruct.ghost);
Ammo.destroy(ghostStruct.shape);
Ammo.destroy(ghostStruct.worldQuat);
const key1 = 'KEY' + ghostStruct.id;
delete AmmoInstance.bodyStructs[key1];
(this.node as any) = null;
(this.wrappedWorld as any) = null;
const bodyStruct = this.bodyStruct;
Ammo.destroy(bodyStruct.body);
Ammo.destroy(bodyStruct.localInertia);
Ammo.destroy(bodyStruct.motionState);
Ammo.destroy(bodyStruct.rbInfo);
Ammo.destroy(bodyStruct.shape);
Ammo.destroy(bodyStruct.startTransform);
Ammo.destroy(bodyStruct.worldQuat);
const key0 = 'KEY' + bodyStruct.id;
delete AmmoInstance.bodyStructs[key0];
const ghostStruct = this.ghostStruct;
Ammo.destroy(ghostStruct.ghost);
Ammo.destroy(ghostStruct.shape);
Ammo.destroy(ghostStruct.worldQuat);
const key1 = 'KEY' + ghostStruct.id;
delete AmmoInstance.bodyStructs[key1];
(this.bodyStruct as any) = null;
(this.ghostStruct as any) = null;
}
onDestroy () {
this._sharedBody.reference = false;
this._btCompound = null;
(this._collider as any) = null;
Ammo.destroy(this._btShape);
Ammo.destroy(this.transform);
Ammo.destroy(this.pos);
Ammo.destroy(this.quat);
Ammo.destroy(this.scale);
(this._btShape as any) = null;
(this.transform as any) = null;
(this.pos as any) = null;
(this.quat as any) = null;
(this.scale as any) = null;
}
private destroy () {
AmmoSharedBody.sharedBodesMap.delete(this.node.uuid);
(this.node as any) = null;
(this.wrappedWorld as any) = null;
const bodyStruct = this.bodyStruct;
Ammo.destroy(bodyStruct.body);
Ammo.destroy(bodyStruct.localInertia);
Ammo.destroy(bodyStruct.motionState);
Ammo.destroy(bodyStruct.rbInfo);
Ammo.destroy(bodyStruct.shape);
Ammo.destroy(bodyStruct.startTransform);
Ammo.destroy(bodyStruct.worldQuat);
const key0 = 'KEY' + bodyStruct.id;
delete AmmoInstance.bodyStructs[key0];
const ghostStruct = this.ghostStruct;
Ammo.destroy(ghostStruct.ghost);
Ammo.destroy(ghostStruct.shape);
Ammo.destroy(ghostStruct.worldQuat);
const key1 = 'KEY' + ghostStruct.id;
delete AmmoInstance.bodyStructs[key1];
(this.bodyStruct as any) = null;
(this.ghostStruct as any) = null;
}
private destroy () {
AmmoSharedBody.sharedBodesMap.delete(this.node.uuid);
(this.node as any) = null;
(this.wrappedWorld as any) = null;
const bodyStruct = this.bodyStruct;
Ammo.destroy(bodyStruct.body);
Ammo.destroy(bodyStruct.localInertia);
Ammo.destroy(bodyStruct.motionState);
Ammo.destroy(bodyStruct.rbInfo);
Ammo.destroy(bodyStruct.shape);
Ammo.destroy(bodyStruct.startTransform);
Ammo.destroy(bodyStruct.worldQuat);
const key0 = 'KEY' + bodyStruct.id;
delete AmmoInstance.bodyStructs[key0];
const ghostStruct = this.ghostStruct;
Ammo.destroy(ghostStruct.ghost);
Ammo.destroy(ghostStruct.shape);
Ammo.destroy(ghostStruct.worldQuat);
const key1 = 'KEY' + ghostStruct.id;
delete AmmoInstance.bodyStructs[key1];
(this.bodyStruct as any) = null;
(this.ghostStruct as any) = null;
onDestroy () {
this._sharedBody.reference = false;
this._btCompound = null;
(this._collider as any) = null;
Ammo.destroy(this._btShape);
Ammo.destroy(this.transform);
Ammo.destroy(this.pos);
Ammo.destroy(this.quat);
Ammo.destroy(this.scale);
(this._btShape as any) = null;
(this.transform as any) = null;
(this.pos as any) = null;
(this.quat as any) = null;
(this.scale as any) = null;
}
onDestroy () {
this._sharedBody.reference = false;
this._btCompound = null;
(this._collider as any) = null;
Ammo.destroy(this._btShape);
Ammo.destroy(this.transform);
Ammo.destroy(this.pos);
Ammo.destroy(this.quat);
Ammo.destroy(this.scale);
(this._btShape as any) = null;
(this.transform as any) = null;
(this.pos as any) = null;
(this.quat as any) = null;
(this.scale as any) = null;
}
private destroy () {
AmmoSharedBody.sharedBodesMap.delete(this.node.uuid);
(this.node as any) = null;
(this.wrappedWorld as any) = null;
const bodyStruct = this.bodyStruct;
Ammo.destroy(bodyStruct.body);
Ammo.destroy(bodyStruct.localInertia);
Ammo.destroy(bodyStruct.motionState);
Ammo.destroy(bodyStruct.rbInfo);
Ammo.destroy(bodyStruct.shape);
Ammo.destroy(bodyStruct.startTransform);
Ammo.destroy(bodyStruct.worldQuat);
const key0 = 'KEY' + bodyStruct.id;
delete AmmoInstance.bodyStructs[key0];
const ghostStruct = this.ghostStruct;
Ammo.destroy(ghostStruct.ghost);
Ammo.destroy(ghostStruct.shape);
Ammo.destroy(ghostStruct.worldQuat);
const key1 = 'KEY' + ghostStruct.id;
delete AmmoInstance.bodyStructs[key1];
(this.bodyStruct as any) = null;
(this.ghostStruct as any) = null;
}
private destroy () {
AmmoSharedBody.sharedBodesMap.delete(this.node.uuid);
(this.node as any) = null;
(this.wrappedWorld as any) = null;
const bodyStruct = this.bodyStruct;
Ammo.destroy(bodyStruct.body);
Ammo.destroy(bodyStruct.localInertia);
Ammo.destroy(bodyStruct.motionState);
Ammo.destroy(bodyStruct.rbInfo);
Ammo.destroy(bodyStruct.shape);
Ammo.destroy(bodyStruct.startTransform);
Ammo.destroy(bodyStruct.worldQuat);
const key0 = 'KEY' + bodyStruct.id;
delete AmmoInstance.bodyStructs[key0];
const ghostStruct = this.ghostStruct;
Ammo.destroy(ghostStruct.ghost);
Ammo.destroy(ghostStruct.shape);
Ammo.destroy(ghostStruct.worldQuat);
const key1 = 'KEY' + ghostStruct.id;
delete AmmoInstance.bodyStructs[key1];
(this.bodyStruct as any) = null;
(this.ghostStruct as any) = null;
}
'worldQuat': bodyQuat,
'wrappedShapes': []
}
AmmoInstance.bodyStructs['KEY' + this.bodyStruct.id] = this.bodyStruct;
this.body.setUserIndex(this.bodyStruct.id);
/** ghost struct */
const ghost = new Ammo.btCollisionObject();
const ghostShape = new Ammo.btCompoundShape();
ghost.setCollisionShape(ghostShape);
ghost.setCollisionFlags(AmmoCollisionFlags.CF_NO_CONTACT_RESPONSE);
this.ghostStruct = {
'id': sharedIDCounter++,
'ghost': ghost,
'shape': ghostShape,
'worldQuat': new Ammo.btQuaternion(),
'wrappedShapes': []
}
AmmoInstance.ghostStructs['KEY' + this.ghostStruct.id] = this.ghostStruct;
this.ghost.setUserIndex(this.ghostStruct.id);
/** DEBUG */
this.body.setActivationState(AmmoCollisionObjectStates.DISABLE_DEACTIVATION);
this.ghost.setActivationState(AmmoCollisionObjectStates.DISABLE_DEACTIVATION);
}