void OnCollisionEnter(Collision a_colInfo)
{
// Ignore losing parts to prisoners
if (!a_colInfo.gameObject.tag.Contains("Passengers"))
{
Rigidbody rbOther = a_colInfo.rigidbody;
// Work out relative collision velocity
Vector3 offsetVel = a_colInfo.relativeVelocity;
float velDiffSqr = offsetVel.sqrMagnitude;
if (rbOther != null)
{
// Evaluate player collision if ramming other
if (a_colInfo.gameObject.tag.Contains("Player") &&
m_rb.velocity.sqrMagnitude >= rbOther.velocity.sqrMagnitude)
{
EvaluatePlayerCollision(a_colInfo.collider, offsetVel, velDiffSqr);
}
}
else
{
// If slamming into a wall
if (a_colInfo.relativeVelocity.sqrMagnitude >= m_bumpVelSqr)
{
InputManager.SetControllerVibrate(gameObject.tag, bumpRumbleStr, bumpRumbleStr, bumpRumbleDurr, true);
// Turn off the passenger tray for a bit
m_shipTray.PowerDownTray();
}
}
// Check part destruction
EvaluatePartCollision(a_colInfo.collider, velDiffSqr);
}
}