Author Topic: Physics example  (Read 14645 times)

Offline AeroShark333

  • float
  • ****
  • Posts: 266
    • View Profile
Re: Physics example
« Reply #45 on: May 29, 2021, 08:28:16 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

Offline aleks1283

  • byte
  • *
  • Posts: 35
    • View Profile
Re: Physics example
« Reply #46 on: May 29, 2021, 08:42:34 pm »
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)))

Offline AeroShark333

  • float
  • ****
  • Posts: 266
    • View Profile
Re: Physics example
« Reply #47 on: May 29, 2021, 09:12:28 pm »
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

Offline aleks1283

  • byte
  • *
  • Posts: 35
    • View Profile
Re: Physics example
« Reply #48 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.
« Last Edit: May 29, 2021, 09:50:54 pm by aleks1283 »

Offline AeroShark333

  • float
  • ****
  • Posts: 266
    • View Profile
Re: Physics example
« Reply #49 on: May 29, 2021, 10:18:49 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 ;)

Offline aleks1283

  • byte
  • *
  • Posts: 35
    • View Profile
Re: Physics example
« Reply #50 on: May 30, 2021, 02:23:42 pm »
 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());
                }
            }
        };