jerome Posted May 7, 2015 Share Posted May 7, 2015 After a long brainstorming with me, me and myself, I finally chose the name rebase() for the upcoming (I hope) function. Let's go :http://www.babylonjs-playground.com/#XSX1M#4 Line 39 = simple box creation as usual, ok ?Line 42 = I choose an arbitrary axis1following lines = I want my mesh oriented like this (my own arbitrary constraints) :- its current x axis should become the axis1- its current y axis should be in the world axis1Oy plane- it should be placed at (4, 4, -4) that's all.I don't know how to rotate it from its current orientation to the target one. And I don't want to learn about quaternion. Sorry, I'm lazzy. Let' go on.Axis1 will be my new x axis in the target orientation. Ok ?So in the following lines, from the axis1, I just created an orthogonal axis2 with the cross product axis1 ^ Axis.Y... which results in a temp vector orthogonal to axis1 and to Y world axis, re-crossed with axis1 and temp to be then in the axis1Oy plane as wanted by my own constraints. Ok ?I just create a last third orthogonal axis 3 = axis1 ^ axis2 And I draw them normalized, from (4, 4, -4) as asked, so you can understand better (line 48) : x = red, y = green, z = blue. A just created box, a target orientation/location defined by 3 orthogonal arbitrary vectors and no knowledge about rotations/quaternions. Right ? Let's uncomment lines 56-57 : http://www.babylonjs-playground.com/#XSX1M#5 Well, just a proto, there are yet many defaults :the normals don't seem correct,the mesh is created as updatableI guess I could solve the normal issue.No idea about how to avoid the updatable...Can we set a mesh updatable for a while, then re-freeze it (if it wasn't originally updatable) ? binyan 1 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.