The problem of different behavior of physics

I create an empty project. I create two objects with coliders. One of them is dynamic (ball), another is static (ground). With normal startup, everything works fine, when you run html-5, the ball drops much slower.
I tried to include “dt” in the project settings. In the normal launch, the ball falls in a different way, but if adjusted, it is acceptable. In html-5, it falls more slowly and behaves erratically. For example, falling to the ground, he does not bounce off but just jerks.
The scene is extremely simple. I did not write any scripts. Everything is standard.

What if you bundle HTML5 instead of doing Build HTML5 (Make sure to tick the Release checkbox as well!)?

Which browser are you using? And OS? Do you see anything weird in the browser dev console?

Please also zip the project and share it with me (bjorn.ritzl@king.com).

bundle HTML5 - did not work. When you start to see the logo and all. Further does not load.

I used opera and chrome, the result is the same. My OS Win 7.

anything weird in the browser dev console - There are some errors, something about the path or the like.

This is a screenshot of the errors, during the html-5 build.

I sent the project to your mail.

1 Like

You need to disable local file restrictions to run a html5 build locally.

1 Like

Regarding bundled HTML5 not working: Chrome (and I’m guessing Opera as well) is a bit picky when trying to open local HTML files that run JavaScript that do HTTP requests (which the loader script does to actually get game resources and engine data). However, I think Firefox gives you a bit more slack in this regard, give it a try it might work.

Debug HTML5 versions of the engine does some OpenGL (more specifically WebGL) error checks that in some browsers impact performance. Checking the “release” checkbox when bundling will produce an engine that does not validate/check these calls and thus could bring you better performance…

To summarize; I would suggest you try bundling to HTML5 with the “release” checkbox checked, then open the resulting HTML file in Firefox (or as @sicher pointed out, disabling local file restrictions in Chrome/Opera) . Just to see if the performance issue has to do with WebGL-calls-verification.

So I started in firefox, it works.

But the problem of physics has remained. It is the same as with a simple build html5
The ball slowly descends and then does not jump and shakes.
I tried to include the option “release” and not include, the ball behaves the same.

I don’t see it in my inbox. Any chance you can send it again or share it via Dropbox, Drive or some other cloud storage service?

https://mega.nz/#!J8oW0ZZS!-7yY-rQPIgs-4-jFTe6m6xX4eDHjywW5mvAPJRJpacs

can you try this on mega

Thanks. That worked. I’ll take a look tomorrow.

I took a quick look. Change the Physics scale and you’re set. It’s currently at 1.0, but something like 0.1 should make it quite a bit more realistic.

1 Like

Already better, but the ball still jerks in html5 mode (in normal build mode works fine) when the rebounce amplitude decreases
Apparently different platforms need different settings?
With the same settings for all platforms will not work?

I do not experience this at all. Build and Build HTML5 produces the exact same results on my Macbook Pro and Chrome browser.

Yes, same code and settings on all platforms. The idea is that you write code once and run it on all supported platforms with the same results (as long as you don’t push a platform above it’s limits)

I’ve noticed that the ball doesn’t come to a complete rest. Is that what you mean?

Yes, maybe I did not say so, he just does not stop.

I would suggest some additional changes to values:

Physics Scale in game.project: 0.02
Tells the physics engine how to scale the physics worlds in relation to the game world for numerical precision, 0.01–1.0. If the value is set to 0.02, it means that the physics engine will view 50 units as 1 meter (1 / 0.02). The default value is 1.0.

Ball Restitution: 0.6
The restitution value sets the bounciness of the object. The value is usually between 0 (inelastic collision—the object does not bounce at all) and 1 (perfectly elastic collision—the object’s velocity will be exactly reflected in the bounce). 0.6 seems to produce good results in your project. Higher values will make it hard for the ball to come to rest.

3 Likes

Thanks for the help and patience, I began to understand better.