My custom cube’ pivot point at zero point(0,0,0) .But i changed it to vertex (width / 2, height / 2, depth / 2). It works correctly in 3.6, but not in 4.0, it also rotates on zero point (0,0,0)
The following code, just the example AdvancedRotation in chater 4 in Away3D 3.6 cookbook (page 125):
var vector:Vector3D=new Vector3D(0,0,1);
var mouseVector:Vector3D=new Vector3D(oX - mouseX, mouseY - oY, 0);
var resVector:Vector3D;
resVector=vector.crossProduct(mouseVector);
resVector.normalize();
var mtr:Matrix3D=new Matrix3D();
var rotDegrees:Number=Math.PI*Math.sqrt(Math.pow( mouseX - oX , 2) +
Math.pow(mouseY - oY, 2))/5;
mtr.appendRotation(rotDegrees , resVector, mesh.pivotPoint);
matrix3D.append(mtr);
matrix3D.position=cube.transform.position;
mesh.transform=matrix3D;
oX = mouseX;
oY = mouseY;