MotherShip.PitchFor C# (CSharp) Method

PitchFor() public method

public PitchFor ( Planet, p ) : float
p Planet,
return float
    public float PitchFor(Planet p)
    {
        Vector3 zero = Vector3.Cross (this.transform.right, (this.transform.position - p.transform.position));
        float pitchAngle = Vector3.Angle (this.transform.forward, zero);
        if (Vector3.Dot (this.transform.up, zero) < 0) {
            pitchAngle = - pitchAngle;
        }
        return pitchAngle;
    }