2D : Colliders are not moving with skeletal animation

Hello Team,

I have a dragbones animation playing and I have attached a fruit sprite with circle collider on top of character’s head. Now when I am playing idle animation, the sprite is moving but the circle collider is not moving with it. I think if I move node position manually, rigidbody should update itself to that position right?

I am using cocos creator 3.2. Thanks.

I can ask engineering to have a look.

2 Likes

It is a issue, the dragbone attached node can not emit an position change event, so the rigidbody can not be update. you need update rigidbody manual in current version.

@ccclass('NewComponent')
export class NewComponent extends Component {
    // [1]
    // dummy = '';

    // [2]
    // @property
    // serializableDummy = 0;
    @property(RigidBody2D)
    eb: RigidBody2D = null!;

    start() {
        PhysicsSystem2D.instance.enable = true;

        PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb |
            EPhysics2DDrawFlags.Pair |
            EPhysics2DDrawFlags.CenterOfMass |
            EPhysics2DDrawFlags.Joint |
            EPhysics2DDrawFlags.Shape;
    }

    update (deltaTime: number) {
        // @ts-ignore
        this.eb._body.syncPositionToPhysics(true)
    }
}
2 Likes

Thanks man! I will try it.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.