Skip to content

Error while getting CircleCollider2D.worldRadius using Box2D-wasm #19192

Description

@DanyloMykhailenko

Cocos Creator version

3.8.8

System information

Microsoft Windows 11 Pro 10.0.26200

Issue description

Can not get CircleCollider2D.worldRadius when using Box2D-wasm. Getting error ("Relevant error log output" is provided).

Relevant error log output

TypeError: B2.CircleShapeGetRadius is not a function
at B2CircleShape.get (circle-shape-2d.ts:35:19)
at CircleCollider2D.get (circle-collider-2d.ts:69:50)
at script.update (script.ts:12:53)
at component-scheduler.ts:299:35
at ReusableInvoker._invoke (component-scheduler.ts:251:13)
at ReusableInvoker.invoke (component-scheduler.ts:213:14)
at ComponentScheduler.updatePhase (component-scheduler.ts:504:28)
at Director.tick (director.ts:780:37)
at Game._updateCallback (game.ts:1086:22)
at Pacer.updateCallback [as _callback] (pacer-web.ts:95:22)

Steps to reproduce

  1. Create new project.
  2. In Feature Cropping -> 2D -> 2D Physics System set Box2D-wasm Based 2D Physics System
  3. Create scene with circle sprite and RigidBody2D and CircleCollider2D components (example project is provided)
  4. Add script to this object with such update method implementation:
update(deltaTime: number) {
        var circleCollider2DComponent = this.node.getComponent(CircleCollider2D)
        var worldRadius = circleCollider2DComponent.worldRadius
        console.log("worldRadius: " + worldRadius)
    }
  1. Click "Play" button (run Preview in Browser)

Minimal reproduction project

box2dwasm-error.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageNeeds to be assigned by the team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions