jangbi Posted May 20, 2018 Share Posted May 20, 2018 Here's the demo. https://www.babylonjs-playground.com/#LS4I1S Firstly, I want to move the cylinder forward(in local axes), so i use mesh.translate(BABYLON.Vector3.Forward(), 1). The cylinder move 1 unit in the y axis instead of z axis(that's what i want), I can understand why the cylinder move in the y axis(because of the rotation), but I want to know how to move the cylinder on the x-z plane forward after rotation by using the local frame of reference. Secondly, how to compute the segments' two end points dynamically, is my code right? this.mesh.computeWorldMatrix(); let matrix = this.mesh.getWorldMatrix(true); this.vertex1 = BABYLON.Vector3.TransformCoordinates(this.vertex1, matrix); this.vertex2 = BABYLON.Vector3.TransformCoordinates(this.vertex2, matrix); (My english is poor, please forgive me) Quote Link to comment Share on other sites More sharing options...
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.