Trying to make a Rubiks cube

Software: Away3D 4.x

Avatar
maddog, Sr. Member
Posted: 22 November 2011 06:10 AM   Total Posts: 118

For fun I am trying to make a Rubiks cube. The problem I am having is after the first rotation the origin of the blocks needs to be changed so that when one of the other sides rotates it rotates properly. I have tried move pivot point. lookat, with no success. As you can see rotationY works, but when I go to rotationX after rotating in the Y axis 3 of the block orientations are now different so it rotates wrong. Anyone got any ideas.

   

Avatar
Fabrice Closier, Administrator
Posted: 22 November 2011 12:13 PM   Total Posts: 1265   [ # 1 ]

It’s probably a case of http://en.wikipedia.org/wiki/Gimbal_lock

You can fix by either multiplying two quaternions or use after each rotation tools.MeshHelper.applyRotations();

   

Avatar
maddog, Sr. Member
Posted: 22 November 2011 03:06 PM   Total Posts: 118   [ # 2 ]

I got it to work, but for some reason

MeshHelper.applyRotations(Mesh(asset));

scales the cubes down by half. I fixed it by do this

Mesh(asset).scaleX = 1;
Mesh(asset).scaleY = 1;
Mesh(asset).scaleZ = 1;

but I was wondering why this is happening?
Thanks for letting me know about mesh helper!!!
 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X