Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
set center (v: IVec3Like) {
const lpos = this._offset as IVec3Like;
Vec3.copy(lpos, v);
Vec3.multiply(lpos, lpos, this._collider.node.worldScale);
if (this._index >= 0) {
commitShapeUpdates(this._body);
}
}
_collider!: ColliderComponent;
protected _shape!: CANNON.Shape;
protected _offset = new CANNON.Vec3();
protected _orient = new CANNON.Quaternion();
protected _index: number = -1;
protected _sharedBody!: CannonSharedBody;
protected get _body (): CANNON.Body { return this._sharedBody.body; }
protected onTriggerListener = this.onTrigger.bind(this);
/** LIFECYCLE */
__preload (comp: ColliderComponent) {
this._collider = comp;
setWrap(this._shape, this);
this._shape.addEventListener('triggered', this.onTriggerListener);
this._sharedBody = (PhysicsSystem.instance.physicsWorld as CannonWorld).getSharedBody(this._collider.node as Node);
this._sharedBody.reference = true;
}
onLoad () {