Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enable static-body on ground with a Heightfield shape (wip)#24

Draft
vincentfretin wants to merge 1 commit intosupermedium:master from
vincentfretin:ground-static-body
Draft

Enable static-body on ground with a Heightfield shape (wip) #24
vincentfretin wants to merge 1 commit intosupermedium:master from
vincentfretin:ground-static-body

Conversation

@vincentfretin
Copy link
Contributor

@vincentfretin vincentfretin commented Oct 9, 2017
edited
Loading

I create the PR so you folks know I'm working on that. I'll probably continue this work in two weeks.

I want my cubes and spheres to rest on the ground, not go through it!
I first tested this.ground.setAttribute('static-body', 'shape', 'hull'); that create a CANNON.ConvexPolyhedron shape, but I had really poor performance on GearVR, lots of frame drop.

While reading some old https://github.com/donmccurdy/aframe-physics-system issues, I stopped at c-frame/aframe-extras#41 and donmccurdy/three-to-cannon#1 where it gave me the idea to try that.
I successfully created a CANNON.Heightfield shape for the generated ground, and it is working great!
I don't have any slowdown with this on GearVR.

I'm sure there are issues with updating the properties of the schema, so please don't merge.
If you want to play with it, please do! ;-)

Here is screenshot with <a-scene physics="debug:true">
capture d ecran de 2017年10月09日 20-37-10

arpu and netgfx reacted with thumbs up emoji arpu and netgfx reacted with hooray emoji
Copy link
Contributor Author

As I said on donmccurdy/three-to-cannon#1 I'll probably move the heightfield creation to three-to-cannon and add an option to the environment component to enable the heightfield creation, disabled by default. And be sure that I don't broke something when a property of the environment component schema changes.

Copy link

arpu commented Dec 23, 2017

@vincentfretin any news on this? works fantastic

Copy link
Contributor Author

@arpu I didn't do anything on this front yet. I still have to do the work I described.

arpu reacted with thumbs up emoji

Copy link

illifly commented Aug 17, 2018
edited
Loading

@vincentfretin Great idea, but i dont get this to work!
I have aframe-environment-component.js and aframe-physics-system.min.js installed on aframe 0.7.0 as well as 0.8.0/0.8.2.
I made your changes on aframe-environment-component.js, check it with console but it takes no effect, i can go through the ground or e.g. pyramids. I also dont see the grid as in your screenshot.
Please, can you help me or show a working example or maybe is there a better solution?
My Code:

<html>
 <head>
 <script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
 <script src="https://www.beverung.de/vr/ground/aframe-environment-component.js"></script>
 <script src="//cdn.rawgit.com/donmccurdy/aframe-physics-system/v3.2.0/dist/aframe-physics-system.min.js"></script>
 </head>
 <body>
<a-scene physics="debug: true">
	<a-entity environment="preset:egypt"></a-entity>
	<a-entity dynamic-body camera look-controls wasd-controls position="0 1.6 0"></a-entity>
</a-scene>
 </body>
</html>

Thank you very much!

When i use physics 3.0.0 i can see the grid, but go still through all...

Copy link
Contributor Author

For the red wireframe, if I remember well, it only appears for me on firefox on desktop, not on chrome on desktop, not sure why.

Copy link
Contributor Author

You can look at my example https://github.com/vincentfretin/aframe-sandbox and compare with yours.

Copy link

netgfx commented Oct 29, 2020

Is this going to be merged at some point? It is really useful!

Copy link
Contributor Author

I don't plan to work on it myself for the time being. It was really a proof of concept for me back in October 2017, time flies :)
I know that the physics system switched from cannon to ammo, so if somebody works on this, they should use ammo now I think.
I know @arpu did similar thing in vrland.io, what tech did you use @arpu for your https://vrland.io/worldg/in map?

Copy link

arpu commented Oct 29, 2020
edited
Loading

i still use the typedscrypt port from cannon https://github.com/pmndrs/cannon-es with the CANNON.Heightfield generated from a heighmap image and https://github.com/mapbox/martini

vincentfretin reacted with heart emoji

@vincentfretin vincentfretin marked this pull request as draft June 15, 2023 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /