thecco Posted January 2, 2014 Share Posted January 2, 2014 hello i have 3 question first. i want to set mesh's center (I do not know correct - if using setpivotposition is correct, how can i make matrix) second, check collision in Uneven ground. last. how to make Underwater. i know BABYLON is not support doubleside. Happy New Year.. (1/2 question image) Quote Link to comment Share on other sites More sharing options...
gwenael Posted January 2, 2014 Share Posted January 2, 2014 For your first question: do you want to set the center of your mesh, let's say, at the barycenter of its vertices and then move the mesh at the right location or actually, you don't really mind about its position but visually you want its vertices to be at the right places? +: vertex0: origin of parent space (or world space if no parent)1: origin of local space ("mesh center")x: where you would like to have the vertices Barycenter 0 + + + + + ++ ++ 1 + x+ + + + + + + + Result: 0 + + + + + + + + + 1 + + + + + + + + + Center it's somewhere... 0 + + + + + ++ ++ + x+ + 1+ + + + + + Result: 0 + + + + + + + + + x + + + 1 + + + + + + For both you will have to set mesh.position at the right location so the cloud of vertices will translate with it. Just be aware that rotation will be different since the center of the rotation will be the center of your mesh (representing by 1). You can indeed change this behavior thanks to the pivot matrix. If you have the position of your pivot, you can create the matrix with BABYLON.Matrix.Translation and then call mesh.setPivotMatrix.var p = BABYLON.Matrix.Translation(x,y,z); // (x,y,z) must be expressed in parent spacemesh.setPivotMatrix(p);I give you only some pists, I hope it's enough. Don't hesitate if I have to be clearer. c75, thecco and GameMonetize 3 Quote Link to comment Share on other sites More sharing options...
thecco Posted January 4, 2014 Author Share Posted January 4, 2014 first question is complete thanks ~~ gwenael 1 Quote Link to comment Share on other sites More sharing options...
gwenael Posted January 4, 2014 Share Posted January 4, 2014 Cool. So how did you do it? Quote Link to comment Share on other sites More sharing options...
gwenael Posted January 14, 2014 Share Posted January 14, 2014 This, http://www.html5gamedevs.com/topic/3083-spaces-world-parent-pivot-local/?p=19938, could help to understand. 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.