Code example:
`@ccclass(“Typescript”)
export class Typescript extends Component {
start() {
this.getComponent(BoxCollider2D)!.on(
Contact2DType.BEGIN_CONTACT,
this.onBeginContact,
this
);
}
onBeginContact(
selfCollider: Collider2D,
otherCollider: Collider2D,
contact: IPhysics2DContact | null
) {
otherCollider.node.active = false;
}
}`
Project with example: test_v3.zip (4.9 KB)