Closed LucaEstiva closed 11 years ago
This works:
protected function updateTransform() : void
{
_pos.x = _x;
_pos.y = _y;
_pos.z = _z;
_rot.x = _rotationX;
_rot.y = _rotationY;
_rot.z = _rotationZ;
_sca.x = _scaleX;
_sca.y = _scaleY;
_sca.z = _scaleZ;
r1 += 1;
r2 = 0;
r3 += 1;
trace( r1 +" "+ r2 +" "+ r3 );
_transformComponents1[0] = new Vector3D(_x, _y, _z);
_transformComponents1[1] = new Vector3D( r1 * MathConsts.DEGREES_TO_RADIANS, r2, r3 * MathConsts.DEGREES_TO_RADIANS);
_transformComponents1[2] = new Vector3D(1.0, 1.0, 1.0);
// _transform.identity();
_transform.recompose( _transformComponents1 );
// if (!_pivotZero) { // _transform.prependTranslation(-_pivotPoint.x, -_pivotPoint.y, -_pivotPoint.z); // _transform.appendTranslation(_pivotPoint.x, _pivotPoint.y, _pivotPoint.z); // }
_transformDirty = false;
_positionDirty = false;
_rotationDirty = false;
_scaleDirty = false;
}
this not...
//-------------------------------------------------------------------------------------------------------------
//
//-------------------------------------------------------------------------------------------------------------
private function enterframeHandler( event:Event ):void
{
// if( mouseIsDown ) // { // cameraController.panAngle = 0.4 * ( view.mouseX - lastMouseX ) + lastPanAngle; // cameraController.tiltAngle = 0.4 * ( view.mouseY - lastMouseY ) + lastTiltAngle; // } // cameraController.panAngle += panIncrement; // cameraController.tiltAngle += tiltIncrement;
VTrident.rotationX += 1.0;
VTrident.rotationZ += 1.0;
//VTrident.rotate( Vector3D.X_AXIS, 1.0 );
//VTrident.rotate( Vector3D.Z_AXIS, 1.0 );
//
view.render();
}
i'm sorry, the code works if the value are absolute vale:
_trx = _trz += 1;
VTrident.rotationX = _trx;
VTrident.rotationZ = _trz;
public function set rotationZ(val:Number):void
{
if (rotationZ == val)
return;
_rotationZ = val * MathConsts.DEGREES_TO_RADIANS;
invalidateRotation();
}
Code here ( TestHoverController1 ): http://79.56.56.179:8086/
After rotating Y 90 deg, Z rotation are incorrect... VTrident.rotationZ += 1.0; - ERROR ! VTrident.rotate( Vector3D.Z_AXIS, 1.0 ); - OK !