aframe-physics-system: Broken in A-Frame 1.2.0

Geometry was completely removed in three.js 125 which is used in A-Frame 1.2.0 https://github.com/mrdoob/three.js/wiki/Migration-Guide

With the current main branch of aframe-physics-system:

aframe-physics-system.js:14331 Uncaught TypeError: t.Geometry is not a constructor
    at u (aframe-physics-system.js:14331)
    at o (aframe-physics-system.js:14331)
    at initBody (aframe-physics-system.js:15151)
    at HTMLElement.emit (aframe-v1.2.0.min.js:2586)
    at aframe-v1.2.0.min.js:2586

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 15
  • Comments: 21 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Easiest solution: Import from examples/js/deprecated/Geometry.js in three.js:

<script src="https://cdn.jsdelivr.net/gh/mrdoob/three.js@r134/examples/js/deprecated/Geometry.js"></script>

Here is the fork of the dist file where it works with A-Frame 1.2: https://github.com/gearcoded/aframe-physics-system/blob/master/dist/aframe-physics-system.js

You can add it to this repository. As I understand, you at least need to update some functions to the new Three.js logic.

@novakcgx it’s not working with AFrame v1.3 and gives the following error: Uncaught TypeError: Cannot read properties of undefined (reading 'addVectors') Do you have any other ideas?

@novakcgx That’s super, nice find.

Do keep in mind that there are real performance benefits to moving away from the deprecated Geometry.js, though, so this should still be regarded as a temp solution.

Great to have that, though, that should allow full compatibility if it works as expected.

aframe-physics-system depend on three-to-cannon package see https://github.com/n5ro/aframe-physics-system/blob/master/package.json#L46

Ah, you mean the maintainers of three-to-cannon needs to fix this so the maintainers of aframe-physics-system can fix that. Got it.

Here is an example of it working: https://github.com/AdaRoseCannon/aframe-xr-boilerplate/blob/9424510ff01fd478b74780ef240473eea7f948e3/index.html

Note I anchored it to a particular commit because in recent versions I started using a modified version of physx instead.

Unfortunately AFrame 1.2.0 fixes some breaking WebXR issues which is forcing people to update to it.