Jump to content

no way to rotate object globaly


phil1234
 Share

Recommended Posts

Hello,

 

I read in the doc that rotation is achieved before translation, but I try to have an offsetted object rotate around the 0,0,0 axis

 

and I cant find any way to achieve this ... 

 

usualy(with other engines) I offset the object on its local axis

then simply rotate it globaly with a matrix/quaterion/rotate function 

 

I tried different combinations of these two

mesh.translate(BABYLON.Axis.X, 3.0, BABYLON.Space.WORLD); //or LOCAL

mesh.rotate(BABYLON.Axis.Y, 1.0, BABYLON.Space.WORLD); //or LOCAL

 

(I wanted to rotate the object position with a quaternion, but the Quaternion lacks of regular/usual .mult(Vector) or .rotate(Vector)

and anyway, it wouldn't be what I want to achieve)

 

any idea ?

 

thanks

Link to comment
Share on other sites

Hi phil... (and hi ice and dk too) welcome to the forum.... good to have you with us.

 

In case you ever need such, I have a cool "bootleg" forum searcher page at http://urbanproductions.com/wingy/babylon/search/form06/form06.htm  (thx to Gryff for the gfx).

 

Phil... tell us about you, and your project(s), if you want.  Thanks!

Link to comment
Share on other sites

ok, but although I can make it work with rotate(), how come it does not work doing this

 

mesh.rotationQuaternion=mesh.rotationQuaternion.multiply(BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0,1,0),angle*Math.PI/180));

 

[edit: oops my bad it works actualy :-) ]

Link to comment
Share on other sites

Hi again, Phil.

 

http://www.babylonjs-playground.com/#H7V1D#13

 

Your line is 34.

 

Notice line 33.  Standard mesh do not have a .rotationQuaternion by default.  It is "turned on" as needed.  https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.abstractMesh.js#L227 (that line should look familiar).  :)  Lines 363 and 419 are also testers for the existence of a quaternion. 

 

Hope this helps.  Party on!

Link to comment
Share on other sites

  • 4 months later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...