private Vector3 CalculateThrustVector(List<Transform> thrustTransforms, LogMsg log)
{
if (thrustTransforms == null)
return Vector3.forward;
Vector3 thrustvec = Vector3.zero;
foreach (Transform trans in thrustTransforms)
{
if (log != null)
log.buf.AppendFormat("Transform = ({0:g6}, {1:g6}, {2:g6}) length = {3:g6}\n", trans.forward.x, trans.forward.y, trans.forward.z, trans.forward.magnitude);
thrustvec -= trans.forward;
}
if (log != null)
log.buf.AppendFormat("ThrustVec = ({0:g6}, {1:g6}, {2:g6}) length = {3:g6}\n", thrustvec.x, thrustvec.y, thrustvec.z, thrustvec.magnitude);
thrustvec.Normalize();
if (log != null)
log.buf.AppendFormat("ThrustVecN = ({0:g6}, {1:g6}, {2:g6}) length = {3:g6}\n", thrustvec.x, thrustvec.y, thrustvec.z, thrustvec.magnitude);
return thrustvec;
}