aframe-physics-system icon indicating copy to clipboard operation
aframe-physics-system copied to clipboard

Broken in A-Frame 1.2.0

Open crcdng opened this issue 3 years ago • 21 comments

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

crcdng avatar Feb 06 '21 16:02 crcdng

came here to report this as well.

https://glitch.com/edit/#!/1-2-0-colorbug

^this glitch shows the error cropping up

Seems to be from the embedded cannon minified line.

kylebakerio avatar Feb 08 '21 01:02 kylebakerio

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

AdaRoseCannon avatar Feb 12 '21 15:02 AdaRoseCannon

Using the Ammo mode fixed the issue and is a good work around.

AdaRoseCannon avatar Feb 12 '21 15:02 AdaRoseCannon

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

True. I am quite happy with 1.2.0, it's just that every component who touches the removed three.js Geometry object and other parts of the API has stopped working. I have started to dive into three and fix things but it's not necessarily my happy place.

crcdng avatar Feb 12 '21 16:02 crcdng

Using the Ammo mode fixed the issue and is a good work around.

Can you elaborate a bit about Ammo mode?

crcdng avatar Feb 12 '21 16:02 crcdng

True. I am quite happy with 1.2.0, it's just that every component who touches the removed three.js Geometry object and other parts of the API has stopped working. I have started to dive into three and fix things but it's not necessarily my happy place.

I opened an issue at A-Frame extras as well https://github.com/n5ro/aframe-extras/issues/348#issue-802589178

I hope we can do some common effort to update components.

crcdng avatar Feb 12 '21 16:02 crcdng

Using the Ammo mode fixed the issue and is a good work around.

Can you elaborate a bit about Ammo mode?

https://github.com/n5ro/aframe-physics-system/blob/master/AmmoDriver.md#installation

AdaRoseCannon avatar Feb 12 '21 16:02 AdaRoseCannon

this is needed https://github.com/donmccurdy/three-to-cannon/pull/32

arpu avatar Feb 12 '21 16:02 arpu

this is needed donmccurdy/three-to-cannon#32

Thanks for the pointer. Do I understand that this thing kind of injects an API around the API, specifically for the physics component? I would suggest to update the aframe-physics-system component such that it works as a component out of the box again.

crcdng avatar Feb 12 '21 17:02 crcdng

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

arpu avatar Feb 12 '21 17:02 arpu

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.

crcdng avatar Feb 12 '21 17:02 crcdng

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.

gearcoded avatar Mar 06 '21 20:03 gearcoded

The Aframe Physics System Cannon version is not working temporarily because it calls the depreciated THREE.Geometry. I opened an issue, I am working on a fix and inviting others to help. In the meantime use Aframe Physics System the Ammo version. https://github.com/n5ro/aframe-physics-system/issues/189

n5ro avatar Apr 20 '21 10:04 n5ro

Some progress on three-to-cannon coming soon, see https://github.com/n5ro/aframe-physics-system/issues/189#issuecomment-826034515.

donmccurdy avatar Apr 24 '21 04:04 donmccurdy

@n5ro apologies if I'm missing something, but the fork from @gearcoded is working for me to get superhands working (with one small line commented out that seemed to be missed, which I've pull requested on his fork).

Is it not possible to get a preliminary release out that uses that fork, for some reason, so that this library works in 1.2.0? I'm still getting errors when I try latest release or master branch here, didn't notice if there's some other branch to be trying...?

Here's my patch on gearcoded's fork that does the same inverse->invert update and removes that one missed line I found, and seems to be working with 1.2.0 and, for example here, super-hands and aframe-physics-extras:

patched fork: https://github.com/kylebakerio/aframe-physics-system/tree/patch-1 (see: dist -> aframe-physics-system.js)

glitch showing working example: view code: https://glitch.com/edit/#!/super-hands-demo?path=index.html%3A17%3A26 open in quest: https://super-hands-demo.glitch.me/

kylebakerio avatar Aug 28 '21 14:08 kylebakerio

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>

cszach avatar Nov 02 '21 02:11 cszach

@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.

kylebakerio avatar Nov 04 '21 13:11 kylebakerio

@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?

Yash-Punia avatar Mar 11 '22 22:03 Yash-Punia

@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?

same issue here. Anyone got a working glitch of aframe-physics-system and aframe 1.3? Not even the official sample on https://aframe.io/docs/1.3.0/introduction/html-and-primitives.html works :(

aaweb avatar May 17 '22 15:05 aaweb

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.

AdaRoseCannon avatar May 17 '22 16:05 AdaRoseCannon

I thought I had seen you post an updated working physics example and intended to hunt it down and link to it, Ada. Glad you stopped by yourself!

I'm not very active in A-Frame right now, but I did the bare minimum for now and added a brief link to this here: https://aframe.wiki/en/physics

So, for anyone in the future wanted to remember how to get back here, that's a good spot.

(Also, join with github and contribute more detailed update to that page, would be super helpful!)

kylebakerio avatar May 17 '22 18:05 kylebakerio