Search the Community
Showing results for tags 'setTimeout'.
-
What is the IMPACT in babylonjs of using window.setTimeout and window.setInterval in your babylon js script code logic vs some kins of frame delay tracking flags and check that time has expired in the 'tick' function then execute action function. Is it 'TABOO' to use browser based timeout and interval functions in your babylonjs game logic Is it preferred to use window.requestAnimationFrame game loop (TICKING) to execute DELAYED or INTERVALED functions ??? As Always... Thanks for any info
-
In the playground "drag and drop" example, in function "onPointerDown()" the camera is detached from the canvas using following code if (startingPoint) { // we need to disconnect camera from canvas setTimeout(function () { camera.detachControl(canvas); }, 0); // camera.detachControl(canvas); } If I remove the setTimeout() and do "detachControl" directly the code works fine on chrome and firefox but fails in IE In IE the camera becomes a free look camera Whats the significance of the "setTimeout()" function?
- 2 replies
-
- settimeout
- camera
-
(and 1 more)
Tagged with:
-
Hi guys ! I 've tried to add some features to an old PG (that I have just mada for a previous topic); that one : http://www.babylonjs-playground.com/#1PTVTW#9 I try to apply an impulse to a sphere that "come out" from the ships (when they reach the island) and hit the target (the cylinder in the middle). It works, but just the for time; instead, I would repeat these applyImpulse on every 1sec (or 2sec), after they reach the island. I try to apply the setTimeout() function, but the result does not work well. Here the other PG (it doesn't work): http://www.babylonjs-playground.com/#1PTVTW#10 . So have any idea on how can I do that? Do you think it's the best way? Thank you in advance for your time and patience, cheers
- 4 replies
-
- applyImpulse
- repetition
-
(and 1 more)
Tagged with:
-
Let's say I have a variable "assets" that is an object and contains several sprites. Inside the update loop, I check the position of each sprite by iterating through the object. If a condition is true (the sprite is outside the game bounds), I want to wait a random amount of milliseconds and then give that sprite a new position without the need of destroying it and creating a new one. I want to use the same amount of sprites and continue re-spawning them until another condition is met (out of lives or whatever). I tried using setTimeout() but it does not work inside the loop. Furthermore, I'm having problems figuring out how to "freeze" one sprite while the rest keep moving (that means I cant pause the update loop, although I don't even know if that's possible). Please keep in mind that this is a mobile game and performance is important. Is it really worth the effort? Should I just kill them and spawn new ones? Thanks for reading.
- 4 replies
-
- delay
- settimeout
-
(and 1 more)
Tagged with: