Hudo1979 Posted July 26, 2016 Share Posted July 26, 2016 I have a demo at http://www.babylonjs-playground.com/#1JMZWJ#11 What I am try to do is create a cylinder between two points, but it seems calculation for y-axis doesn't work. in the demo I move the target in all three directions (x,y,z) and I can clearly see the cylinder doesn't connect two points, but if I comment away the movement of y axis, the angle seems to be correct, I am really puzzled, can anyone help me? I am new at 3d programming and new at BabylonJS Quote Link to comment Share on other sites More sharing options...
jerome Posted July 26, 2016 Share Posted July 26, 2016 maybe you could you use RotationFromAxis() : http://doc.babylonjs.com/overviews/How_Rotations_and_Translations_Work#generating-a-rotation-from-a-target-system example : http://www.babylonjs-playground.com/#VYM1E#9 methods : http://doc.babylonjs.com/classes/2.4/Vector3#static-rotationfromaxis-axis1-axis2-axis3-rarr-vector3-classes-2-4-vector3- http://doc.babylonjs.com/classes/2.4/Vector3#static-rotationfromaxistoref-axis1-axis2-axis3-ref-rarr-void Quote Link to comment Share on other sites More sharing options...
Hudo1979 Posted July 26, 2016 Author Share Posted July 26, 2016 hmm, seems this only work on x-axis? is it possible to point with y-axis? Quote Link to comment Share on other sites More sharing options...
adam Posted July 26, 2016 Share Posted July 26, 2016 http://www.babylonjs-playground.com/#1JMZWJ#22 jerome 1 Quote Link to comment Share on other sites More sharing options...
adam Posted July 26, 2016 Share Posted July 26, 2016 http://www.babylonjs-playground.com/#1JMZWJ#23 jerome 1 Quote Link to comment Share on other sites More sharing options...
Hudo1979 Posted July 26, 2016 Author Share Posted July 26, 2016 Thank you! so the error is the angle calculate only took consideration to two axis? which way is more preferred, rotationQuertenion or rotationAroundAxis? Could you please if possible explain what I did wrong? Thank you so much. Quote Link to comment Share on other sites More sharing options...
Hudo1979 Posted July 26, 2016 Author Share Posted July 26, 2016 If i want the animation to work to simulate the laser effect, how should I merge in that local rotation? Seems I really should find my old linear algebra book... Quote Link to comment Share on other sites More sharing options...
Hudo1979 Posted July 26, 2016 Author Share Posted July 26, 2016 Ok, seems I can apply the rotation animation on the child element instead Quote Link to comment Share on other sites More sharing options...
adam Posted July 26, 2016 Share Posted July 26, 2016 42 minutes ago, Hudo1979 said: Could you please if possible explain what I did wrong? You needed to reverse the cross and acos the dot. http://www.babylonjs-playground.com/#1JMZWJ#34 dbawel 1 Quote Link to comment Share on other sites More sharing options...
Hudo1979 Posted July 26, 2016 Author Share Posted July 26, 2016 Thank you! Quote Link to comment Share on other sites More sharing options...
jerome Posted July 27, 2016 Share Posted July 27, 2016 @adam I really need to implement your smart QuaternionFromAxis() function in the framework Unless you do it before, I'll probably do it by the middle of september adam 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.