Hello!
I’m trying to rotate an ObjectContainer3D by settings it’s transform property. For some reason when I set my container.transform it doesn’t update, though if I trace out the matrix it has changed.
Here is my code:
private function loop(e:Event):void {
var currentMousePoint:Point = new Point(view.mouseX, view.mouseY);
if (rotateModel) {
var difference:Point = currentMousePoint.subtract(previousMousePoint);
var vector:Number3D = new Number3D(difference.x, difference.y, 0);
var rotationAxis:Number3D = new Number3D();
rotationAxis.cross(vector, FORWARD);
rotationAxis.normalize();
var distance:Number = Point.distance(currentMousePoint, previousMousePoint); //rotates based off DMouse
var rotMat:MatrixAway3D = new MatrixAway3D();
rotMat.rotationMatrix(rotationAxis.x, -rotationAxis.y, 0, distance/150);
var newMat:MatrixAway3D = new MatrixAway3D();
newMat.multiply3x3(rotMat, container.transform);
//for testing, not functional
var m:MatrixAway3D = new MatrixAway3D();
m.sxx = -1.02;
m.sxy = -1.02;
m.sxz = -1.02;
m.syx = -1.02;
m.tz = -1.02;
/////
container.transform.clone(newMat); //not updating even though the a trace of newMat AND container.transform shows updated values
//container.transform = m; //THIS works and Updates
trace(container.transform);
previousMousePoint = currentMousePoint;
}
view.render();
}
Now I have used similar code on some pv3d projects and it has worked. For some reason it doesn’t seem like away3d is updating my objects transform matrix. If I set the transform to m it does update