Commit 3db5ccbb authored by 16이진형's avatar 16이진형

Merge branch 'collision-model' of...

Merge branch 'collision-model' of https://git.kucatdog.net/flatland/curvedflats into collision-model
parents 12770ec8 269b6d8a
......@@ -339,6 +339,8 @@ public class FlatlandMovement : MonoBehaviour
}
Vector3 col = (other.v - this.v);
var totalThreeMomentum = this.GetThreeMomentum() + other.GetThreeMomentum();
var tmp = collision.GetContact(0).normal;
tmp = new Vector3(tmp.x, 0, tmp.z);
......@@ -377,4 +379,27 @@ public class FlatlandMovement : MonoBehaviour
alpha -= collisionforce;
collisionforce = new Vector3(0, 0, 0);
}
public double GetEnergy()
{
return Constants.Gamma(v.magnitude) * mass * Constants.c * Constants.c;
}
public Vector<double> GetThreeMomentum()
{
var twop = GetTwoMomentum();
double[] tmp = { GetEnergy() / Constants.c, twop[0], twop[1] };
var result = V.DenseOfArray(tmp);
return result;
}
public Vector<double> GetTwoMomentum()
{
double[] tmp = {Constants.Gamma(v.magnitude) * mass * v.x, Constants.Gamma(v.magnitude) * mass * v.z};
var result = V.DenseOfArray(tmp);
return result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment