XAEA
January 17, 2022, 7:35am
#1
onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
this.scheduleOnce(() => (otherCollider.node.active = false))
}
Same problem in this topic problem on collision detection when node have speed
Cocos Version 3.4.0
Editor
8f5e859
Engine
b11686b
Native
28b6bc7
Native(External)
a52c327
Engine extensions
a52c327
Editor extensions
d9530a8
Runtime
d9530a8
I can ask engineering if they have thoughts.
Koei
January 21, 2022, 6:27am
#3
The triggering of the physical system is related to the setting of these parameters. If the speed is too fast, you can optimize it by adjusting fixedTimeStep and maxSubSteps, checking bullet.
2 Likes
XAEA
March 12, 2023, 9:08am
#4
another problem is that the speed increases every time the node is reactivated.
it related problem onBeginContact: Error while set active property on node
XAEA
March 12, 2023, 10:13am
#5
ok, I think the problem is solved.
onLoad () {
this.rigidBody2D = this.getComponent(RigidBody2D);
}
onEnable() {
this.rigidBody2D.linearVelocity = Vec2.ZERO
}