Jump to content

Rotation problem


spoboyle
 Share

Recommended Posts

http://www.babylonjs-playground.com/#18OA3I#6

I seem to be having a problem understanding rotations.

I have imported a model and am attempting a couple of things but first problem

scene.getMeshByName("Cylinder002").rotation.y += 0.01;

and

scene.getMeshByName("Cylinder002").rotation.z += 0.01;

seem to rotate the model about the same axis. can anyone explain whats going on?

Also the rotation doesn't seem to occur around the centre on the object.

this does seem to do what I want to do (even if i can't get my camera in the correct position for the moment)

scene.getMeshByName("Cylinder002").rotate(new BABYLON.Vector3(0, 1, 0), 0.01, BABYLON.Space.LOCAL);

Link to comment
Share on other sites

runRenderLoop = a render Loop always render, everything.

registerBeforerender = before the renderLoop (physics, meshoptimasation etc) 

afterRender = after the renderLoop (everything loaded?, shaders are compiled etc.)

You have to reset the origin "pivotPoint" of your model you can do it i a 3D modeling soft  or per code see:

 

Link to comment
Share on other sites

Okay, so you can open your .babylonfile in a txt editor of your chose you will see some data and then

"name":"Cylinder002","position":[0.0,0.0,14.375],"rotation":[-1.5708,0.0,0.0],

this is the problem the initial rotation of your mesh. Its not the  PivotPoint. Thanks Adam. 

 

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