n5ro / aframe-physics-system

Physics system for A-Frame VR, built on CANNON.js.
https://n5ro.github.io/aframe-physics-system/
MIT License
505 stars 136 forks source link

Broken in A-Frame 1.2.0 #187

Open crcdng opened 3 years ago

crcdng commented 3 years ago

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
kylebakerio commented 3 years ago

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.

AdaRoseCannon commented 3 years ago

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

AdaRoseCannon commented 3 years ago

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

crcdng commented 3 years ago

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 commented 3 years ago

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

Can you elaborate a bit about Ammo mode?

crcdng commented 3 years ago

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.

AdaRoseCannon commented 3 years ago

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

arpu commented 3 years ago

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

crcdng commented 3 years ago

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.

arpu commented 3 years ago

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

crcdng commented 3 years ago

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.

gearcoded commented 3 years ago

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.

n5ro commented 3 years ago

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

donmccurdy commented 3 years ago

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

kylebakerio commented 3 years ago

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

cszach commented 2 years ago

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>
kylebakerio commented 2 years ago

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

Yash-Punia commented 2 years ago

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

aaweb commented 2 years ago

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

AdaRoseCannon commented 2 years ago

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.

kylebakerio commented 2 years ago

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