Physics example

Started by Thomas., March 10, 2012, 10:29:28 PM

Previous topic - Next topic

AeroShark333

Quote from: aleks1283 on May 29, 2021, 02:27:57 PM
When i do - aaa[f].matMul(cyl7.getRotationMatrix());   // or  aaa[f].rotate(cyl7.getRotationMatrix());         
                    X77[f] = aaa[f].x + cyl7.getTranslation().x;
                    Y77[f] = aaa[f].y + cyl7.getTranslation().y;
                    Z77[f] = aaa[f].z + cyl7.getTranslation().z; all good(coordinates,and the shape of the object) but object wrong(infinite) rotation,instead of the original turn
Then do you need the inverse matrix of the rotationmatrix? I believe there's an option... You can also manually align the sourcemesh to the object mesh I guess...
I'm not sure if it is easily possible

aleks1283

I understand what the problem is. If initially the object had some kind of rotation angle or movement, then when the frames are updated and when multiplied by the matrix, it does not become in its proper place, but adds value every time. Even if the original object is no longermoves and does not turn.how to solve this problem ???
So I don't like these vector movements)))

AeroShark333

I believe if values are repetitively added, I suppose you should do an inverse operation at the end of what you are doing..? So maybe the inverse matrix or something would help (Matrix.invert()).

What you could also do is not apply the initial rotation at first but only at the end maybe. So after your vertex controller things..?

I'm not sure if I entirely understand your problem. It's hard to understand if you don't see what's happening

aleks1283

#48
Thanks, I hope you see a cool game this year.
I need something like object.clearRotation and preferably object.clearTranslation to apply to sourceMesh.clearRotation and sourceMesh.clearTranslation.

AeroShark333

Quote from: aleks1283 on May 29, 2021, 09:41:09 PM
Thanks, I hope you see a cool game this year.
I need something like object.clearRotation and preferably object.clearTranslation to apply to sourceMesh.clearRotation and sourceMesh.clearTranslation.
Good luck ;)

aleks1283

 I defeated the first dragon !!! Fixed.Working.


VVV2 = new GenericVertexController() {
            @Override
            public void apply() {
                SimpleVector[] aaa = getSourceMesh();
                int lll=aaa.length;
                X77 = new float[lll];
                Y77 = new float[lll];
                Z77 = new float[lll];
                for (int f=0;f<lll;f++)
                {
                    aaa[f].matMul(cyl7.getWorldTransformation());
                    X77[f] = aaa[f].x;
                    Y77[f] = aaa[f].y;
                    Z77[f] = aaa[f].z;
                    aaa[f].matMul(cyl7.getWorldTransformation().invert());
                }
            }
        };