Jump to content

is scene.getAnimationRatio() used to substitute deltaTime


securet
 Share

Recommended Posts

what would be the best approach to move a Mesh constantly independently form framedrops?

mesh.moveWithCollisions(new BABYLON.Vector3(x,y,z))

or would 

moveWithCollisions(new BABYLON.Vector3(x*scene.getAnimationRatio(),y*scene.getAnimationRatio(),z*scene.getAnimationRatio()) 

be better

or would an other approach be better?

Link to comment
Share on other sites

well, it all depends how you define your velocity (the variable provided to moveWithCollisions). 

You could multiply it by deltaTime, divide it by the current FPS, or use the animation ratio (which is set like this: animationRatio = deltaTime * (60.0 / 1000.0);) . All depends on your initial velocity vector.

Link to comment
Share on other sites

again, depends on your variables and your scale :) moveWithCollision(new Vector3(0.0001, 0.0001, 0.0001)) will be smooth for sure, but will probably get you nowehere. If all of your meshes are 100000 units big, then setting the velocity to 10 will probably be smooth as well.

Just experiment. Give it a try, you will figure it out.

Link to comment
Share on other sites

k, ty.

Maybe I used the wrong word, by smooth I meant the speed of the mesh should stay the same, independent from the FPS

So I want the mesh to travel the same amount of space no matter if the FPS is at 60 or 20. So multiplying by the animationRatio should do the job.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...