Jump to content

Best approach to moving mesh quickly along a fixed path


CaptainJustin
 Share

Recommended Posts

Good day

I'm working on a small multiplayer game and I've bumped into a problem.

I'd like to ask the community if you have any ideas about moving a mesh along a well understood line (xyz --> xyz) at a particular speed?

 

At the moment I'm using a 'hacky solution'. 

 setInterval

 

mesh.position.x += Math.sin(this.sBullet.point.rotation) * this.sBullet.speed * 3
mesh.position.z += Math.cos(this.sBullet.point.rotation) * this.sBullet.speed * 3

I've noticed some lag when there are many bullets flying around.

It occurred to me, that with the path and speed being static at the point of the bullet being instantiated I might be able to "set it up and let it go".

 

May I ask if anyone has come across a super efficient way to hand this over to Babylon or a lower level instead of using a timer and increment it every couple ms in JS?

 

 

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...