Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add physics example #270

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

add physics example #270

wants to merge 2 commits into from

Conversation

vincentfretin
Copy link
Member

Add a physics example with ammo driver.
refs #193

Capture d’écran de 2021-04-10 18-03-34
Capture d’écran de 2021-04-10 18-36-24

@vincentfretin
Copy link
Member Author

Note that with aframe 1.1.0 or 1.2.0 and aframe-physics-system 4.0.1, there are infinite warnings "THREE.Quaternion: .inverse() has been renamed to invert()." when you open the console, see n5ro/aframe-physics-system#183

@vincentfretin
Copy link
Member Author

vincentfretin commented Apr 10, 2021

If you want a wall to block your avatar, you need a nav-mesh
see https://github.com/n5ro/aframe-extras/tree/master/src/pathfinding
and something like this

      <a-entity id="navmesh" gltf-model="navmesh.gltf" visible="false" nav-mesh></a-entity>
      <a-entity id="player" movement-controls="constrainToNavMesh: true"

But this is currently broken with aframe 1.2.0, you may stick with 1.1.0 for now, see c-frame/aframe-extras#349

@vincentfretin
Copy link
Member Author

Also there is a #physics channel on Slack, see this thread https://aframevr.slack.com/archives/C3WGUL4K0/p1617736493000900 with the status of the different physics engine.

@vincentfretin
Copy link
Member Author

Also for this particular example in this PR, we shouldn't be able to move a cube if we don't own it. I'll fix that later.

@n5ro
Copy link

n5ro commented Apr 11, 2021

I'm still working on a fix to navmesh https://glitch.com/edit/#!/navmesh1
https://glitch.com/edit/#!/navmesh
https://glitch.com/edit/#!/navmesh2

Feel free to read the commented code in each index file for details. I am trying to replace Three.Geometry which has been deleted from threejs with BufferGeometry. I could use some help testing this and writing this code, please remix the links and try to get it working also. In the meantime use Aframe 1.1.0 with A-Frame Extras until we get this fixed.

@vincentfretin
Copy link
Member Author

With the example, the second user doesn't see the cube. Actually it's there but the cube is dropping indefinitely :D

document.querySelector('.cube').getAttribute('position')
Object { x: 0.37061196913538613, y: -22879.074609375, z: -0.39367493127928344, … }

I think the static ground is not initialized before the cube is spawned by networked-aframe. Using connectOnLoad:false and clicking a button to enter the room may fix the issue. I didn't test.

@vincentfretin
Copy link
Member Author

About my comment #270 (comment)
"We shouldn't be able to move a cube if we don't own it".
Actually it may be better to listen to the collide event and call takeOwnership on the cube.

Contributions to this example are welcome. I won't be working on it right now.

@kylebakerio
Copy link
Member

About my comment #270 (comment)
"We shouldn't be able to move a cube if we don't own it".
Actually it may be better to listen to the collide event and call takeOwnership on the cube.

yes, this is definitely how I've envisioned it should work

@kylebakerio
Copy link
Member

Just a heads up, I was able to get aframe-physics-system working with super hands in A-Frame 1.2.0 here today (using standard CANNON instead of AMMO): n5ro/aframe-physics-system#187 (comment)

Figure that might be helpful in moving this forward. I'm interested in helping with this (and responding and continuing on the networked controllers pull request), just swampped with work right now.

@n5ro
Copy link

n5ro commented Aug 29, 2021 via email

@kylebakerio
Copy link
Member

kylebakerio commented Aug 29, 2021

@n5ro did you mean to respond here in the NAF pull request, or was that comment intended for the aframe-physics-system repo issue thread?

Either way, sounds good. Have you tried that fork, though?

@kylebakerio
Copy link
Member

Just wanted to drop this thread here: https://discourse.threejs.org/t/preferred-physics-engine-cannon-js-ammo-js-diy/1565

I really feel like CANNON may have been too quickly dismissed by Diarmid there, as CANNON is generally regarded as having extremely realistic physics. Performance is also an issue in all physics libraries. CANNON does have the best documentation, though, of the physics libraries, from what I've read.

I also have been using that fork of aframe-physics-system mentioned in a prior comment successfully in a client project and that's still going well for me in 1.2.0.

@vincentfretin
Copy link
Member Author

We can change the example I started to use CANNON instead of ammo if we have now a working version with aframe 1.2.0. I'll just be glad we have a more complete networked physics example with any physics engine. ;)

@vincentfretin
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants