CaptainJustin Posted May 15, 2018 Share Posted May 15, 2018 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? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 15, 2018 Share Posted May 15, 2018 This may be able to help you : https://www.babylonjs-playground.com/#92EYG#21 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
CaptainJustin Posted May 15, 2018 Author Share Posted May 15, 2018 Thank you @Dad72. This looks fantastic! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.