Matrix Collision Maya
A few days ago I uploaded a small video showing a test to calculate collisions.
So this is the set up. How does it work?
I. INTRODUCTION
The first thing I decided when starting this setup was that I was not looking for a constraint to a geometry, I wanted the ability to be able to move on it or to be able to move away at any time.
That means that we will be calculating the distance we are from the geometry during all the time to make a blend between the main control or the attached position
II. RIG SYSTEM
As first of all we will have to get the point closest to the control in relation to the geometry and take a matrix from it.
To do that we will use the "closetPointOnMesh" to collect that position from the "offsetCollision"
Now we need to get the rotation,for this we will use two "vectorProduct" nodes in "cross" mode.
One of the vectors will be for our Upvector so we will need a cross between our normal and set to 1 the second input that we requier as Upvector.
The other vector will be a cross product between the normal and the Upvector .
领英推荐
Once calculated our matrix we would have what is the exact point of the geometry but we need the Point of "offset" between the geometry and our control so for this we will create a "multMatrix" where we will connect the matrix that gives us our "fourbyFourMatrix" and the "inverseMatrix" of our "offsetControl"
To conclude we will have a "pairblend" to calculate which matrix is the one that commands
if it is greater than 0 it will be moved by the mainControl and if not it will stay "stuck" to the geometry
Our Input 2 we will require some calculations
we must create a "multmatrix" between our matrix and the WorldMatrix of our Main control,
We do this so that it denies its transformation and the target stays "stuck" to the geometry
III. CONCLUSION
Once all this is done we will have our "geometry constraint collision" working.
When we are on top of the geometry we will take the values of the matrix that we have created and once we move away the command will change to our main control