Jump to content

rotation x and y or z not working


Mars
 Share

Recommended Posts

var cylinder = BABYLON.Mesh.CreateCylinder("cylinder", 10, 10, 10, 10, 1, scene, false);
cylinder.rotation.x = -Math.PI/2;

engine.runRenderLoop(function () {
  cylinder.rotation.z += 0.01;
  scene.render();
});

This should be rotation by z, but it rotation by y???

If I change the "cylinder.rotation.z += 0.01;" to "cylinder.rotation.y += 0.01;", it have the same result.

Why?

Link to comment
Share on other sites

Hi Mars,

let's make a playground so that we can all see what you mean: http://www.babylonjs-playground.com/#TRIV4#0

I think that problem is that when you rotate the cylinder around it's x-axis the direction of it's z-axis changes. Not sure what you final goal is, but if you jsut want a cylinder laying on its side and beeing rotated, you could bake the first rotation into the cylinder and then do the other rotations: http://www.babylonjs-playground.com/#TRIV4#1

Is that the desired result?

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