solartistic Posted November 1, 2014 Share Posted November 1, 2014 Hello there, I am having a problem. I am trying to create a function with (position, rotation and speed) in its artibutes, that will return a new position. Like in the title i want the returned position to be the point that the rotation of the object its pointing in the distance of "speed" if I am not clear, imagine a spaceship that travels in space in any direction it wants but always with its prow pointing forward; I think free cameras moves in similar way; I've made a demo with a function "fly" that is completly wrong http://playground.babylonjs.com/#1RLOQY#1 Can you please try to help me? Quote Link to comment Share on other sites More sharing options...
Stephen Andrews Posted November 2, 2014 Share Posted November 2, 2014 Hello there, I am having a problem. I am trying to create a function with (position, rotation and speed) in its artibutes, that will return a new position.Like in the title i want the returned position to be the point that the rotation of the object its pointing in the distance of "speed" if I am not clear, imagine a spaceship that travels in space in any direction it wants but always with its prow pointing forward; I think free cameras moves in similar way; I've made a demo with a function "fly" that is completly wronghttp://babylonjs-playground.azurewebsites.net/#1RLOQY#1 Can you please try to help me? I think what you want is to move the ship in local space right? Relative to the object? Use: mesh.rotate(BABYLON.Axis.Z, 0.01, BABYLON.Space.LOCAL);mesh.translate(BABYLON.Axis.Y, 0.1, BABYLON.Space.LOCAL);Example Quote Link to comment Share on other sites More sharing options...
Temechon Posted November 3, 2014 Share Posted November 3, 2014 Hey there, check this : http://www.html5gamedevs.com/topic/2264-move-forward-and-rotation/?hl=tank Cheers, Quote Link to comment Share on other sites More sharing options...
solartistic Posted November 3, 2014 Author Share Posted November 3, 2014 Hi Temechon,Ive already knew that algoritm and it is for translating on planes only, it would work for me if the rotation.x and the rotation.z is 0, but the object im trying to move is flying. TriBlade9:By the time my post was displayed and it was responded, i've learned about "localyTranslate" function and I think the result is similar. Thank you for your solution too. Quote Link to comment Share on other sites More sharing options...
Temechon Posted November 4, 2014 Share Posted November 4, 2014 Hey, Maybe this will help you more : http://playground.babylonjs.com/#NFJFE Use WASD to move the plane. c75 1 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.