Open lealzhan opened 1 year ago
There are some issues if using worker:
web worker
, how to add this feature for those platforms?message
may be expensive.I do not believe a web worker would be necessary. The only thing that is needed is a new director event inside of the while loop in postUpdate of the physics-system. There are currently two director events Director.EVENT_BEFORE_PHYSICS and Director.EVENT_AFTER_PHYSICS. If you simply add a new event right before this.physicsWorld.step then that could work. Director.EVENT_BEFORE_STEP_PHYSICS.
If you wanted to add the fixedUpdate callback in the component, then you could register for this director event in components that define fixedUpdate.
@mikecoker , good point. Also, I think that we should not trigger a user callback outside engine's main loop.
If I'm not mistaken - without fixedUpdate we do not get the relevant positions of objects that are moving with code/physics?
I mean instead of getting 15 FPS in game and seeing the real speed of arrow (it will get the monster in 0.2 seconds) we will get slow-mo version of game where arrow will travel to monster in 3 seconds?
I had this problem with Godot webgl export, but Godot has _physicsProcess
which is similar to Unity fixedUpdate. When I started using _physicsProcess
in Godot - it fixed the problem.
I really hope Cocos will implement fixedUpdate too. I'm yet to encounter problem with it but I assume it will be the same as in Godot.
Guys, is it possible to achieve without some patch or update? Like a workaround of some kind.
I'm having my game run slow in some browsers, like slow mode. I would rather have low FPS but position of objects to be true to the time passed.
Is there any progress made on this issue?
Is there any progress made on this issue?
Currently I have workaround using custom component derived from default one but with fixedUpdate method. Nothing too fancy (simple fixed update implementation), I can share here if you'd like.
Thanks. I was mostly just wondering if they are planning on supporting this in the engine or if it is DOA. We can work around it, but it would be nice if the engine supported it.
I understand it will be harder to achieve on web platform because it's single threaded. @dumganhar @minggo if it's only for physics, can we use worker to run wasm physics module and make fixed update possible ?