Jump to content

Mesh not rotating


Democore
 Share

Recommended Posts

Hey everyone,

I'm currently facing the problem, that whenever I try to rotate a Mesh using the .rotation property, it won't rotate at all. It only works via the rotate() method.

Example:

m.rotate(BABYLON.Axis.X, Math.PI/4, BABYLON.Space.WORLD); //works

m.rotation.x = Math.PI/4; //won't work
m.rotation = new BABYLON.Vector3(Math.PI/4, 0, 0); //won't work

The code gets executed from an event handler. Changing scale and position works no problem btw.

I also checked several .babylon models, which all had  the same problem.

 

I feel like I'm missing something big, since this is such a basic feature. Any Help is much appreciated!

Link to comment
Share on other sites

Hey adam, thanks for the responce!

I'm aware of what the difference between the two methods is. The Problem is, that I want to set the rotation to a static value using mesh.rotation, which is not working.

If I'd use mesh.rotate(), the mesh would turn further instead of snapping to the right rotation.

Link to comment
Share on other sites

2 hours ago, Temechon said:

If you try on an imported mesh, you have to first reset the rotaionQuaternion : 


m.rotationQuaternion = null;
m.rotation.x = Math.PI/4;

 

Yep, that was it! Thanks so much!

Why is this not documented in the rotation documentation? :(

Link to comment
Share on other sites

@adam : this is something new introduced by bjs 2.4. 

@Democore: this is documented ;) http://doc.babylonjs.com/overviews/How_Rotations_and_Translations_Work ( rotation will be used if rotationQuaternion property is null (This is the default behavior). rotationQuaternion is used if both are set. ) regarding your PG it was a bug in cache engine :) it is fixed now!

 

Link to comment
Share on other sites

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...