Jump to content

Sphere Rolling Rotation Question


Bagel
 Share

Recommended Posts

Hello,

I'm brand new to babylon.js. I'm working on making a sphere roll. I have it set up to roll of a keystroke event. How I set up getting my ball rolling is:

sphere.rotation.z -= rightSpeed;

sphere.rotation.z += leftSpeed;

sphere.rotation.x += forwardSpeed;

sphere.rotation.x -= backSpeed;

These are being handled as the key is being pressed down. Obviously there is a flaw in the way I'm implementing this as I rotate my z axis to the point that when I go to turn right and left it looks similar to the earth rotating. I'm just hoping someone can point me in the right direction so that as I move forward, back, left, right (along with their combinations) that I can get the sphere to rotate in the appropriate direction.

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