本文整理汇总了C#中Vessel.Bounds方法的典型用法代码示例。如果您正苦于以下问题:C# Vessel.Bounds方法的具体用法?C# Vessel.Bounds怎么用?C# Vessel.Bounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vessel
的用法示例。
在下文中一共展示了Vessel.Bounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComputeManeuver
bool ComputeManeuver(Vessel v, out Vector3d maneuver)
{
maneuver = Vector3d.zero;
//calculate distance
var dir = (v.CurrentCoM-VSL.Physics.wCoM);
var dist = dir.magnitude;
dir /= dist;
//first try to get TCA from other vessel and get vessel's R and Exhaust
var vR = 0f;
var vB = new Bounds();
Transform vT = null;
var tca = ModuleTCA.EnabledTCA(v);
if(tca != null)
{
// if(tca.CPS != null &&
// tca.CPS.IsActive &&
// VSL.Physics.M > tca.VSL.Physics.M &&
// VSL.vessel.srfSpeed > v.srfSpeed) //test
// return false;
vR = tca.VSL.Geometry.R;
vB = tca.VSL.Geometry.B;
vT = tca.VSL.refT;
}
else //do a raycast
{
RaycastHit raycastHit;
if(Physics.SphereCast(VSL.Geometry.C+dir*(VSL.Geometry.R+0.1f), VSL.Geometry.R, dir,
out raycastHit, dist, RadarMask))
vR = (raycastHit.point-v.CurrentCoM).magnitude;
vT = v.ReferenceTransform;
vB = v.Bounds(vT);
vB.Encapsulate(v.EnginesExhaust());
}
//compute course correction
var dV = VSL.vessel.srf_velocity-v.srf_velocity+(VSL.vessel.acceleration-v.acceleration)*CPS.LookAheadTime;
var thrershold = -1f;
if(v.LandedOrSplashed) thrershold = 0;
else if(Dangerous.Contains(v.id)) thrershold = CPS.SafeDistance;
if(AvoideVessel(VSL, dir, dist, dV, vR, vB, vT, out maneuver, thrershold))
Dangerous.Add(v.id);
else Dangerous.Remove(v.id);
return !maneuver.IsZero();
}