Ejemplo n.º 1
0
        private Vector3[] GetRayDirections()
        {
            Vector3[] rayDirections = new Vector3[5];
            float     forwardAngle  = SteeringHelper.VectorToOrientation(transform.forward);

            rayDirections[0] = transform.forward;
            rayDirections[1] = SteeringHelper.OrientationToVector(forwardAngle + sideRayAngle * Mathf.Deg2Rad);
            rayDirections[2] = SteeringHelper.OrientationToVector(forwardAngle + (sideRayAngle / 2) * Mathf.Deg2Rad);
            rayDirections[3] = SteeringHelper.OrientationToVector(forwardAngle - (sideRayAngle / 2) * Mathf.Deg2Rad);
            rayDirections[4] = SteeringHelper.OrientationToVector(forwardAngle - sideRayAngle * Mathf.Deg2Rad);

            return(rayDirections);
        }
Ejemplo n.º 2
0
        private bool DetectedObstacle(Vector3 facingDir, out GenericCastHit firstHit)
        {
            facingDir = controller.ConvertVector(facingDir).normalized;

            Vector3[] dirs = new Vector3[3];
            dirs[0] = facingDir;

            float orientation = SteeringHelper.VectorToOrientation(facingDir);

            dirs[1] = SteeringHelper.OrientationToVector(orientation + sideWhiskerAngle * Mathf.Deg2Rad);
            dirs[2] = SteeringHelper.OrientationToVector(orientation - sideWhiskerAngle * Mathf.Deg2Rad);

            return(CastWhiskers(dirs, out firstHit));
        }
Ejemplo n.º 3
0
 private void SteerByWire(FlightCtrlState c)
 {
     if (Value is string && ((string)Value).ToUpper() == "KILL")
     {
         SteeringHelper.KillRotation(c, Vessel);
     }
     else if (Value is Direction)
     {
         SteeringHelper.SteerShipToward((Direction)Value, c, Vessel);
     }
     else if (Value is Vector)
     {
         SteeringHelper.SteerShipToward(((Vector)Value).ToDirection(), c, Vessel);
     }
     else if (Value is Node)
     {
         SteeringHelper.SteerShipToward(((Node)Value).GetBurnVector().ToDirection(), c, Vessel);
     }
 }
Ejemplo n.º 4
0
 private void SteerByWire(FlightCtrlState c)
 {
     if (!Enabled)
     {
         return;
     }
     if (value is string && ((string)value).ToUpper() == "KILL")
     {
         SteeringHelper.KillRotation(c, control.Vessel);
     }
     else if (value is Direction)
     {
         SteeringHelper.SteerShipToward((Direction)value, c, control.Vessel);
     }
     else if (value is Vector)
     {
         SteeringHelper.SteerShipToward(((Vector)value).ToDirection(), c, control.Vessel);
     }
     else if (value is Node)
     {
         SteeringHelper.SteerShipToward(((Node)value).GetBurnVector().ToDirection(), c, control.Vessel);
     }
 }