aaahhh.... much better like this:

function rotateMatrix(object:Object3D, x:Number, y:Number):void{

        var rot1:Matrix3D=new Matrix3D();
        var rot2:Matrix3D=new Matrix3D();
        rot2.appendRotation(y, Vector3D.X_AXIS);
        rot1.appendRotation(x, Vector3D.Y_AXIS);
        rot1.append(rot2);
        //rot1.append(object.transform);
        object.transform = rot1;
}


excactly what i was looking for, besides the fact that the object doesn
´t keep the position when i click a second time after moving and
releasing the mouse button.
btw...i call this function mit the mouseX and mouseY like this:
if(mDown)rotateMatrix(myObject,-(mdiff.x)/4,-(mdiff.y)/4);

If i do not comment out the 1 line, the object keeps the position, but
the rotation is strange.
I think i almost solved my problem. Seems like there is only 1 line
incorrect??

------------------

On 27 Nov., 01:10, fab4ce <[email protected]> wrote:
> i tried it like this:
>
> function rotateMatrix(object:Object3D, x:Number, y:Number):void{
>         var rot1:Matrix3D=new Matrix3D();
>                 var rot2:Matrix3D=new Matrix3D();
>                 rot1.appendRotation(-y, Vector3D.X_AXIS);
>                 rot1.appendRotation(x, Vector3D.Y_AXIS);
>                 rot1.append(rot2);
>                 rot1.append(rot1);
>                 object.transform = rot1;
>
> }
>
> It compiles now...but it doesnt behave like 2 matrixes. The object
> rotates correct on the y axis but x is behaving strange...like not
> "free"
>
> On 24 Nov., 10:53, fab4ce <[email protected]> wrote:
>
> > hmmm....that sounds good....besides the fact that i don´t know much
> > about the matrix math.
> > Sometimes you want to use pieces of code that you don´t understand at
> > all.
> > I do just ask because it is such a little function: Could you or
> > someone else please translate it to 3.6 standard, line by line?
>
> > On 23 Nov., 23:13, Michael Iv <[email protected]> wrote:
>
> > > use matrix.append(anotherMatrix)-for multiplication
> > > for setting rotation portion of the matrix I think you should first
> > > decompose the matrix which returns a vector object containing 3 portions 
> > > of
> > > the matrix (If I remember correctly second index is rotational
> > > portion,please refer to AS3 docs) and then you assign your values to that
> > > part and recompose it back to you matrix.
>
> > > On Tue, Nov 23, 2010 at 10:34 PM, fab4ce <[email protected]> wrote:
> > > > how do write this in Away3D 3.6 ?
>
> > > > function rotateMatrix(object:Object3D, x:Number, y:Number):void{
> > > >    var rot1:Matrix3D=new Matrix3D();
> > > >    var rot2:Matrix3D=new Matrix3D();
> > > >    rot1.rotationMatrix(0,1,0,x);
> > > >    rot2.rotationMatrix(1,0,0,y);
> > > >    rot1.multiply(rot1, rot2);
> > > >    rot1.multiply(rot1,object.transform);
> > > >    object.transform = rot1;
> > > > }
>
> > > --
> > > Michael Ivanov ,Programmer
> > > Neurotech Solutions Ltd.
> > > Flex|Air 
> > > |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.nethttp://www.meetup...
> > > Tel:054-4962254
> > > [email protected]
> > > [email protected]

Reply via email to