n5ro / aframe-physics-system

Physics system for A-Frame VR, built on CANNON.js.

Home Page:https://n5ro.github.io/aframe-physics-system/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken in A-Frame 1.2.0

crcdng opened this issue · 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

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.

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

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

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.

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

Can you elaborate a bit about Ammo mode?

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 c-frame/aframe-extras#348 (comment)

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

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

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.

commented

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

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

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. #189

Some progress on three-to-cannon coming soon, see #189 (comment).

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

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>

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

@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 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 :(

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.

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!)