Hello! I’m currently working on a game where I need to check if a mesh has intersect another one.
Everything seems to work fine except when one mesh go faster. At the moment, I’m simply moving a mesh position in the scene.onBeforeRenderObservable like this :
mesh.position.y += (scene.deltaTime /1000 * mySpeed)
Sometimes, according to the mobile device, it might skip some frames. Since the mesh is a bit small, it does not trigger. Is there a way to get a fixed framerate to avoid skipping any frame or simply having a better solution.
Thanks!
Maybe some average like RollingAverage is enough for you:
Hi,
In order to ensure that players with a higher framerate don’t actually move faster I want to incorporate deltatime into my main game loop. However, several issues have arisen when trying to implement this in babylon.The following examples are based on the answers given in: fps-affects-game-speed-framerate-independence (on this forum).
First, when I just update the position with engine.getDeltaTime() * speed, there is a very noticeable jitter:
https://playground.babylonjs.com/#J6U7V4
This…
Also check out:
Hi,
I’m trying to understand the difference between engine.getDeltaTime and scene.getAnimationRatio. Can someone help me to understand it?
Another thing that I noticed is: when using FollowCamera to follow an object that is moved using elapsedTime = engine.getDeltaTime, the camera goes tremulous. If I remove the elapsed time, the camera movement is smooth. Am I making something wrong?
I’m using this code to move my object:
let elapsedTime = (GAME.engine.getDeltaTime() / 1000),
gravity =…
Hello guys ,
As i unity developer i just want to ask a quick question
Which method in mesh class Match update function in unity … What it means i want each mesh to have it’s own update method rather use scene.registerBeforeRender() Which controls every update/render happens in the scene
I’ve used those func’s
mesh.onBeforeDrawObservable()
mesh.onAfterRenderObservable()
But Explicitly i don’t know if it’s best choice or not and i have little problem with it … cuz those methods can’t …
Hi, I'm writing an app that essentially only needs to render when the user does something. There are a few edge cases that cause one-time animations, all other stuff is a one time render situation. The main reason to avoid the render loop is that...
Or reduce overall scaling (i.e. mesh sizes), so you can decrease your speed value.
2 Likes