eva-engine / eva.js

Eva.js is a front-end game engine specifically for creating interactive game projects.
https://eva.js.org
MIT License
1.75k stars 108 forks source link

使用物理引擎报错 #9

Closed DaiHuaXieHuaKai closed 3 years ago

DaiHuaXieHuaKai commented 3 years ago
const physics = ball.addComponent(
  new Physics({
    type: PhysicsType.CIRCLE,
    bodyOptions: {
      isStatic: false, // 物体是否静止,静止状态下任何作用力作用于物体都不会产生效果
      restitution: 0.8,
      frictionAir: 0.1,
      friction: 0,
      frictionStatic: 0,
      force: {
        x: 0,
        y: 0,
      },
      stopRotation: true, // 默认false,通常不用设置
    },
  }),
);

抛出异常: TS2769: No overload matches this call. Overload 1 of 2, '(C: Component): Component', gave the following error. Argument of type 'Physics' is not assignable to parameter of type 'Component'.

fanmingfei commented 3 years ago

出现这个问题的原因是插件引用了不同版本的@eva/eva.js 尝试一下重新安装所有npm包 保持所有eva和eva插件的版本一致

The reason for this problem is that the plugin references different versions of @eva/eva.js Try to keep all Eva.js plugins in the same version, and re install all node_modules.

fanmingfei commented 3 years ago

请问。。问题能够解决吗?