忽略本次碰撞contact.disabled=true似乎不起作用?

  • Creator 版本:3.7.2

  • 之前哪个版本是正常的: 3.7.0

  • 目标平台:win11

  • 重现方式:node自然下落,在BEGIN_CONTACT里忽略碰撞contact.disabled=true,然而node会站在了一个node之上

  • 手机浏览器:chrome

  • 编辑器操作系统:

  • 重现概率:100%

实现目的,英雄node自然下落,穿过下面的node,类似很版游戏里的【下】+【跳跃】
详细描述查看这个帖子:

横板游戏角色从【场景】下跳上【场景】站着如何实现,比如《忍者龙剑传》、《超级玛丽》、《宾尼兔大冒险》

1、根据cocos 3.7文档介绍,只需设置contact.disabled=true就可以了。可是实际没起到效果!我遗漏了什么吗?
2、disabledOnce为什么设置成true,打印居然还是false

切换成3.7.0,可以正常运行

https://docs.cocos.com/creator/manual/zh/physics-2d/physics-2d-contact-callback.html?h=begin_contact

    onBeginContact (selfCollider: BoxCollider2D, otherCollider: BoxCollider2D, contact: IPhysics2DContact | null) {
            contact.disabled = true;
            contact.disabledOnce = true;
            console.log("begin", contact)
    }

5

在预解算回调里面设置这个. onPreSolve是这个类似名字的回调??

我这里使用v3.7.1版本,2D物理引擎,不能注册PRE_SOLVE
F12也提示 ”pre-solve’ is removed since v3.7.1.”

暂时也没找到该函数被移除后,官方给了啥替代方法 :joy:

源码注释里说修改引擎 PhysicsContactListener 去实现该目的,关键我不懂怎么改

···
export const Contact2DType: {

    None: string;

    BEGIN_CONTACT: string;

    STAY_CONTACT: string;

    END_CONTACT: string;

    /**

        * @deprecated Since v3.7.1, PhysicsSystem2D doesn't directly emit the contact events emitted by box2d.

        * If you need this event, try to modify the relevant engine code(mainly PhysicsContactListener).

        */

    PRE_SOLVE: string;

    /**

        * @deprecated Since v3.7.1, PhysicsSystem2D doesn't directly emit the contact events emitted by box2d.

        * If you need this event, try to modify the relevant engine code(mainly PhysicsContactListener).

        */

    POST_SOLVE: string;

};

···

切换到3.7.0版本,可以正常运行,在BEGIN_CONTACT、PRE_SOLVE设置disable设置disable都行

我也是一样的问题,有解决办法吗?

解决了吗?我现在也是这个问题

3.7.3 还是这问题,有办法了吗

解决了吗 sss

建议用3.8

从3.7.3升级到
3.8.0
contact.disabledOnce = true无效?
contact.disabled是有效的

@lealzhan