cocos-engine icon indicating copy to clipboard operation
cocos-engine copied to clipboard

Physicial contact 2D always call back parameter "contact" of zero-vector normal.

Open LightingX opened this issue 3 years ago • 2 comments

Cocos Creator version

3.6.2

System information

Windows 10 Editor

Issue description

I have 2 rigid bodys which are not sensors with Box2D engine, but when contact calling back, the contact param is always zero-vector normal, the configs, codes and logs are as list: image

image

image

Relevant error log output

{ "colliderA": null, "colliderB": null, "disabled": false, "disabledOnce": false, "_impulse": null, "_inverted": false, "_b2contact": null }

{ "points": [], "separations": [], "normal": { "x": 0, "y": 0 } }

Steps to reproduce

onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) { if (otherCollider.tag === COLLIDER_TAG.BASKET) { let contactWordInfo: IPhysics2DWorldManifold = contact?.getWorldManifold(); console.log("get score", contact, contactWordInfo, contactWordInfo.normal); this.node.dispatchEvent(new ScoreIncreaseEvent(true, {increase: 1})); this.scheduleOnce(() => { this.node.destroy(); }); } }

Minimal reproduction project

No response

LightingX avatar Nov 21 '22 15:11 LightingX

@LightingX could you please provide a demo? Thanks.

minggo avatar Apr 23 '24 08:04 minggo

JJ. Liu已收到来自您的邮件,请耐心等待处理,谢谢。

LightingX avatar Apr 23 '24 08:04 LightingX