Sign in to follow this  
CaptainJustin

Best approach to moving mesh quickly along a fixed path

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?

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.