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

[kinematic-body] scene shakes / bounces #225

Closed
rrrepos opened this issue Apr 23, 2018 · 25 comments
Closed

[kinematic-body] scene shakes / bounces #225

rrrepos opened this issue Apr 23, 2018 · 25 comments

Comments

@rrrepos
Copy link

rrrepos commented Apr 23, 2018

The following has been observed.

Periodically (every few seconds) the whole scene seems to jump (bounce/shake) up and down with the following versions.
aframe v0.8.2
aframe-extras v4.0.2
aframe-physics-system v2.0.1

A glitch project has been created to demonstrate the same:
https://short-canoe.glitch.me/

@donmccurdy
Copy link
Collaborator

Thanks for the bug report — the issue appears with the newest version of physics (v3.1.1) too it looks like. Was there a previous version of any of these where you weren't seeing the issue before?

@donmccurdy donmccurdy added the bug label Apr 23, 2018
@rrrepos
Copy link
Author

rrrepos commented Apr 23, 2018

I just tried the following in the same glitch project.

a. changed the aframe ver to 0.7.1
b. changed the aframe-extras to 3.13.1
c. removed the aframe-physics (since it is part of extras v 3.13.1)
d. removed the rig
e. changed the look-controls to universal-controls

and the shaking stops

And this is my first use of physics so am not familiar with any earlier versions

@dsinni
Copy link
Contributor

dsinni commented Apr 23, 2018

For what it's worth, here is another demo of the "bouncing": https://codepen.io/dansinni/pen/MGYwWK

@Healz4Life
Copy link

Healz4Life commented Apr 30, 2018

This has also been a big issue for me as well, along with much worse shakiness when the player is bigger or smaller then a size around 3, flinging backwards around size 2 and floating when you look above the middle of the screen at size 0.3, though that seems to have to do more with the super-hands component. There's a 3 month competition I've been doing so the example I have is a bit more complex but here it is if you wish to see it: https://freddykruggor.gitlab.io/Project_X . Still not quite finished. Two more notes, if you put a box on another box it will have the same shakiness the player does until the box on top falls off the one beneath it, as well the player doesn't shake as much when moving.

@donmccurdy
Copy link
Collaborator

donmccurdy commented Apr 30, 2018

@flamingfox101 kinematic-body has some configuration for size that would, with or without this bug, need to be addressed for scaled players: https://github.com/donmccurdy/aframe-extras/blob/master/src/misc/kinematic-body.js#L28-L34

I should also mention for reference that I strongly recommend using a navigation mesh rather than kinematic-body for constraining player movement. There is a new bug in v4 where jitter is worse with kinematic-body, but it has never worked particularly well and can glitch in all kinds of strange ways. The outcome with a navigation mesh (after the initial time investment of setting it up...) will be much better.

EDIT: For clarity I do still plan on fixing this bug, at least back to its pre-v4 state. But nevertheless will be recommending navigation meshes and investing more time on that side of things moving forward.

@Healz4Life
Copy link

I'll try that out. Thanks for the advice and keep up the good work :)

@donmccurdy
Copy link
Collaborator

donmccurdy commented May 2, 2018

Also — here's a (very) experimental thing I'm working on that's worth a try. I'm writing a plugin for the A-Frame inspector that builds a navmesh for the current scene.

Steps:

  1. Add script.
<script src="https://recast-api.donmccurdy.com/aframe-inspector-plugin-recast.js"></script>
  1. Add plugin component to scene.
<a-scene inspector-plugin-recast> ... 
  1. Open inspector, configure, and press "Build".

screen shot 2018-05-01 at 7 45 36 pm

  1. Export navmesh, and use it in a scene with the usual instructions.

EDIT: Repo for bug reports: https://github.com/donmccurdy/aframe-inspector-plugin-recast

@rrrepos
Copy link
Author

rrrepos commented May 2, 2018

Thanks @donmccurdy .

I just tried on a simple scene: floor + 4 walls + one box at the centre. Opened Inspector. Clicked on the scene. Clicked on Build. After a few seconds gave an error. Console showed.

screen shot 2018-05-02 at 8 43 41 am

The glitch is: https://glitch.com/edit/#!/magnificent-columnist

@donmccurdy
Copy link
Collaborator

Hm looks like a-sky is breaking it. Removing that and shuffling things around a bit gives some results:

screen shot 2018-05-01 at 8 37 23 pm

But anyway, yeah, it's likely to have a lot of rough edges right now. 😅

@rrrepos
Copy link
Author

rrrepos commented May 2, 2018

Hmm. Can you please share the glitch of the above. I am still getting a no navigation-mesh error after build when I click on Export.

screen shot 2018-05-02 at 9 16 20 am

I added an <a-entity nav-mesh></a-entity> to the scene too. Tried w/ wo the entity. What am I doing wrong?

And appreciate the plug-in even if it has a few rough edges for now.

@donmccurdy
Copy link
Collaborator

donmccurdy commented May 2, 2018

Now I think your grid is just too small, and the barriers too low, for the default navmesh parameters. Otherwise it's fine, you don't have to include a nav-mesh component.

Here's one I've adjusted a bit:

https://cherry-teacher.glitch.me/

note how it goes over the lower barriers, because of the agentMaxClimb setting:

screen shot 2018-05-01 at 8 59 54 pm

@rrrepos
Copy link
Author

rrrepos commented May 2, 2018

ok. Thanks. will check it

@rrrepos
Copy link
Author

rrrepos commented May 2, 2018

@donmccurdy : This works well. Thanks.

Why does the plug-in require a larger <a-grid>. In the example, the room size is 3x3 but if I set the grid size to be 5x5, if fails, while if I change it to 10x10 it works.

@donmccurdy
Copy link
Collaborator

Not sure. 😁 Guessing that if your agentRadius is 0.2 then you need passages of at least 0.4, and enough buffer to allow for approximation errors. Which you should have in the 3x3 grid, but maybe not. This is using the Recast library, and I don't know the details about how it works.

@donmccurdy
Copy link
Collaborator

If you'd like to report bugs, the repo is here: https://github.com/donmccurdy/aframe-inspector-plugin-recast

@rrrepos
Copy link
Author

rrrepos commented May 2, 2018

ok. will study that library and report a bug if necessary. Thanks

@dsinni
Copy link
Contributor

dsinni commented May 3, 2018

Amazing stuff, @donmccurdy!

@dsinni
Copy link
Contributor

dsinni commented Sep 17, 2018

Hi, @donmccurdy. Just wanted to check in to see if any progress has been made on this front.

I know there's a big push for using nav-mesh, but the kinematic-body route still makes the most sense for certain use cases.

As @rrrepos stated, it worked well enough with A-Frame 0.7.1 and aframe-extras 3.13.1, but kind of regressed with the newer versions of each, including aframe-physics-system.

Aside from kinematic-body, I've also noticed that if you stack a bunch of boxes with dynamic-body, there is much more movement. I've played with the restitution value and such with no luck.

At this point, do you think it likely to achieve the working state of 3.13.1 (or better) with newer versions of A-Frame?

Thanks, man.

@donmccurdy
Copy link
Collaborator

donmccurdy commented Sep 23, 2018

@dsinni do you have an example demonstrating lots of movement with stacked boxes? I have one (stress.html) that shows minimal movement; but some movement is unavoidable.

With kinematic-body I can reproduce the shaking issue, but I don't think I have the time to spend on kinematic-body any more at this point — it's taken a huge amount of maintenance effort already, and I'd rather spend that time on things that work well with WebXR, which kinematic-body probably never will. Note that Mozilla Hubs is using the nav mesh system, and frankly it works better than kinematic-body ever has.

@dsinni
Copy link
Contributor

dsinni commented Sep 23, 2018

I'll put some together and post here. Thanks for the reply, Don.

@dsinni
Copy link
Contributor

dsinni commented Sep 23, 2018

That stress test link appears to be using A-frame 0.6.0 and a 3.*.* version of aframe-extras, which was pretty stable by comparison. I'll show the comparison when I post. Thanks again.

@donmccurdy
Copy link
Collaborator

That stress test link appears to be using A-frame 0.6.0 and a 3.. version ...

Ah good point, I should definitely update all those test cases anyway... at first look the boxes still seem stable with A-Frame 0.8.2, but yeah more examples would be appreciated. 👍

@dsinni
Copy link
Contributor

dsinni commented Sep 24, 2018

Okay, so it's been a little while since I first experienced the issue with the "crates" (stacked dynamic-bodys), and apparently some of behavior has improved.

There appears to be less of a variation between using aframe 0.7.1 with aframe-extras 3.13.1 and aframe 0.8.2 with aframe-extras 4.2.0 and aframe-physics-system 3.2.0 since updating.

This is based on old code, but updated to show each version:

0.7.1 + 3.13.1:
https://codepen.io/dansinni/full/RMbyyp/

0.8.2 + 4.2.0 + 3.2.0:
https://codepen.io/dansinni/full/dmGjrR/

I actually timed the collapse of the crates (haha), and it took approximately 25 seconds for the crates to fall in 3.13.1 and approximately 20 seconds in 4.2.0. Definitely not a big deal and the results will obviously vary.

So, it seems the issue is mostly with kinematic-body. I understand your points about using nav-mesh; I just really liked the ability to jump and be able to traverse dynamic objects, etc.

That said, I think I may have discovered an unrelated bug with dynamic-body. See #270.

Thank you, sir.

@donmccurdy donmccurdy added this to the 4.3.0 milestone Nov 20, 2018
@donmccurdy donmccurdy changed the title scene shakes (bounces) when using in conjunction with aframe-physics [kinematic-body] scene shakes (bounces) when using in conjunction with aframe-physics Nov 22, 2018
@donmccurdy donmccurdy changed the title [kinematic-body] scene shakes (bounces) when using in conjunction with aframe-physics [kinematic-body] scene shakes / bounces Nov 22, 2018
@donmccurdy
Copy link
Collaborator

The kinematic-body component should be more stable in the next release, with the caveat that jumping is disabled by default. You can restore that option with kinematic-body="enableJumps: true" (in addition to using jump-ability), but doing so will make the player more "shaky" again.

@dsinni
Copy link
Contributor

dsinni commented Nov 23, 2018

I'll take it! Thanks, Don!

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

No branches or pull requests

4 participants