text: [{"Owner":"saltemishel","Date":"2017-11-27T07:51:24Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHi All_co_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tI would like to use lookAt to make the mesh rotate towards a target_co_ but currently it face the angle immediately.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tHow do I make it turn towards the target angle gradually?\n_lt_/p_gt_\n\n_lt_p_gt_\n\tAlso_co_ I notice a strange behavior_co_ when I change the value of rotationQuaternion of the mesh directly by perhaps doing mesh.rotationQuaternion.x+_eq_0.02_sm_ the mesh get stretched instead of rotated.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThanks\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"brianzinn","Date":"2017-11-27T08:17:49Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\thi saltemishel_co_\n_lt_/p_gt_\n\n_lt_p_gt_\n\ti can_t_t take credit for this PG_co_ but does a gradual rotation with Quaternion.SlerpToRef_dd_ _lt_a href_eq__qt_https_dd_//www.babylonjs-playground.com/#UMQ4UR%232_qt_ rel_eq__qt_external nofollow_qt__gt_https_dd_//www.babylonjs-playground.com/#UMQ4UR#2_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tChange the _qt_slerpAmount_qt_ to adjust the speed.  ie_dd_ 0.1 will slow it down.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tFor rotating the mesh on X you can use rotate function instead of working on rotationQuaternion directly - i think amount is in radians.\n_lt_/p_gt_\n\n_lt_pre_gt_\n_lt_code_gt_mesh.rotate(BABYLON.Axis.X_co_ Math.PI / 4_co_ BABYLON.Space.LOCAL)_sm__lt_/code_gt__lt_/pre_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"saltemishel","Date":"2017-11-27T08:21:18Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHi brianzinn_co_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tIt_t_s still cool_co_ thanks a lot for your help! _lt_img alt_eq__qt__dd_D_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_biggrin.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/biggrin@2x.png 2x_qt_ title_eq__qt__dd_D_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"SvenFrankson","Date":"2017-11-27T09:19:46Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHi_co_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tDoing rotationQuaternion.x +_eq_ 0.02 will not make the mesh rotate around anything_co_ it_t_s not the way Quaternion work. You_t_d better do something like\n_lt_/p_gt_\n\n_lt_p_gt_\n\trotationQuaternion _eq_ BABYLON.Quaternion.RotationAxis(BABYLON.Axis.X_co_ 0.02).multiply(rotationQuaternion)\n_lt_/p_gt_\n\n_lt_p_gt_\n\tI_t_m facing the same issues with the LookAt method_co_ as it does not return a Quaternion (so you can_t_t make a Slerp from your current rotationQuaternion to the lookAt rotationQuaternion)_co_ \n_lt_/p_gt_\n\n_lt_p_gt_\n\tHere_t_s a method (at the end of the script) that returns a lookAt Quaternion from which you can call slerp.\n_lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_a href_eq__qt_http_dd_//playground.babylonjs.com/#BXCG2Q_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//playground.babylonjs.com/#BXCG2Q_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"saltemishel","Date":"2017-11-27T09:51:46Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHi SvenFrankson_co_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tCool_co_ will try that out. _lt_img alt_eq__qt__dd_)_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/smile@2x.png 2x_qt_ title_eq__qt__dd_)_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\tFor the _lt_span style_eq__qt_background-color_dd_#ffffff_sm_color_dd_#353c41_sm_font-size_dd_14px_sm__qt__gt_rotationQuaternion_co_ why do we use multiply instead of add?_lt_/span_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"SvenFrankson","Date":"2017-11-27T10:17:46Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHere they try to explain what you might want to do with quaternion addition _dd_\n_lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_a href_eq__qt_https_dd_//gamedev.stackexchange.com/questions/121021/adding-quaternions-is-useful_qt_ rel_eq__qt_external nofollow_qt__gt_https_dd_//gamedev.stackexchange.com/questions/121021/adding-quaternions-is-useful_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThe reason why you add vectors to compose translations and multiply quaternions to compose rotations is out of my math knowledge ^^\n_lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"saltemishel","Date":"2017-11-27T10:27:13Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tThanks~ I_t_ll try to digest it as much as I can lol\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Wingnut","Date":"2017-11-27T12:50:23Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHi guys!  Here_t_s another way.\n_lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_a href_eq__qt_https_dd_//www.babylonjs-playground.com/#HH1U5%2376_qt_ rel_eq__qt_external nofollow_qt__gt_https_dd_//www.babylonjs-playground.com/#HH1U5#76_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tRecently_co_ I made some utility funcs... move_co_ moveTo_co_ spin_co_ spinTo_co_ scale_co_ scaleTo  (yawn).  They are each wrappers for _lt_strong_gt_BABYLON.Animation.CreateAndStartAnimation_lt_/strong_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tYou can see them at the top of that playground.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tLet_t_s go find the call.  Lines 144-149. \n_lt_/p_gt_\n\n_lt_p_gt_\n\tPRETEND that the pink box is called dummyLookAtTarget and it is set .visibility _eq_ 0_sm_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tUsing the moveTo animator (with cubic ease in/out built-in_co_ but also removable)... you can make box4 do an animated-lookAt... by just animating the dummy target position... to the ACTUAL target position.  (The first parameter in moveTo() is un-used and can be removed.)\n_lt_/p_gt_\n\n_lt_p_gt_\n\tHard to explain_co_ but easy to see it happen.  Grab that moveTo function for your project... and borrow some test lines from 144 - 149 area_co_ if you wish. \n_lt_/p_gt_\n\n_lt_p_gt_\n\tIt_t_s probably not the BEST solution_co_ but it still IS one.  _lt_img alt_eq__qt__dd_)_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/smile@2x.png 2x_qt_ title_eq__qt__dd_)_qt_ width_eq__qt_20_qt_ /_gt_ Party on!\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"saltemishel","Date":"2017-11-28T09:15:55Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHi Wingnut_co_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tWoaw! That_t_s gonna be really useful for many projects!\n_lt_/p_gt_\n\n_lt_p_gt_\n\tWill definately play around with it.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tThanks for sharing! _lt_img alt_eq__qt__dd_D_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_biggrin.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/biggrin@2x.png 2x_qt_ title_eq__qt__dd_D_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Wingnut","Date":"2017-11-28T11:53:19Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\t_lt_img alt_eq__qt__dd_)_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/smile@2x.png 2x_qt_ title_eq__qt__dd_)_qt_ width_eq__qt_20_qt_ /_gt_  Cool.  I wish I could take credit... but really... all this power comes from the ability to make a mesh invisible.  That feature opened-up a ton of possibilities. Invisible grouping-parents_co_ cam gizmos_co_ light gizmos_co_ physicsImpostors_co_ etc.  Invisible mesh_co_ and un-rendered _qt_empty mesh_qt_... have been _qt_the solution_qt_ for tons of projects/issues.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tAdam used a blank mesh_co_ recently_co_ to _lt_a href_eq__qt_https_dd_//www.babylonjs-playground.com/#BFM7EX_qt_ rel_eq__qt_external nofollow_qt__gt_make ONLY a bounding box_lt_/a_gt_.  I bookmarked that puppy a few hundred times.  We might never finish the list of things possible with invisible and blank mesh.  I love _t_em.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tAnd the spinTo/moveTo/scaleTo/colorTo stuff... all possible because of createAndStartAnimation().  I look good (sometimes)... because-of tools written by others_co_ and not because of anything seen when Wingnut looks into a mirror.  _lt_img alt_eq__qt__dd_D_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_biggrin.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/biggrin@2x.png 2x_qt_ title_eq__qt__dd_D_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\tPS_dd_ I had an un-used skybox in that #75 playground_co_ so I removed it and updated link to _lt_a href_eq__qt_https_dd_//www.babylonjs-playground.com/#HH1U5%2376_qt_ rel_eq__qt_external nofollow_qt__gt_#76_lt_/a_gt_.\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"saltemishel","Date":"2017-11-29T09:00:33Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\t_lt_img alt_eq__qt__dd_D_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_biggrin.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/biggrin@2x.png 2x_qt_ title_eq__qt__dd_D_qt_ width_eq__qt_20_qt_ /_gt_ well you still need to have gone through all those process in your brain to gain your _qt_Wingnut_qt_ experience.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tSo the credit is definitely yours for sure as no one have the same experience as everyone else! _lt_img alt_eq__qt__dd_D_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_biggrin.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/biggrin@2x.png 2x_qt_ title_eq__qt__dd_D_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\t \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"}]