# Using Minimum Translation Vector in SAT algorithm

I am working on a simple rigid-body physics engine ,I've already implemented SAT algorithm for collision detection and everything works fine, Now i get to step to use MTV to calculate the distance which objects might move to, In my case the two objects are cubes ,Actually i am a little confused about the distance and how to use it

Here is the two cubes Both of them are on the same y-axis and z-axis, Only differs in x-axis

I am calculating MTV and i get:

samllest which refers to the smallest axis, So it looks like (x,y,z).

overlapDistance which refers to the smallest overlap distance as a double variable.

I know that overlapDistance is the distance that one of two cubes should move till no collision

But how to use it , How cubes should respond to this distance ?

Sorry if i am not clear, but for summary i know the smallest overlap distance but i don't know how to get use of it

• What is the context? Do you want to separate the two cubes if they overlap, or do you want to resolve a collision? The MTV is fine in the first case, but pretty much useless in the latter – Bálint Jun 2 at 16:09
• I want to resolve the collision so each cube goes to the right place , Any idea for this i would be thankful – Abdulrahman Jun 2 at 17:26 If you don't care, then it's pretty simple. Just take the smallest vector, multiply it by overlapDistance and subtract it from the position of the moving square