Exemplo n.º 1
0
    public void SetBearing(float x, float y, float z)
    {
        //Debug.Log("SetRotation: "+ x.ToString() + "," + y.ToString() + "," +z.ToString());

        //TODO: alusta bearing parametrit.
        // fixedupdaten autopilotstate.bearingTurn caseen suoritetaan kääntörutiin.

        //var xDeg = SDegree(x);

        autopilotState = autoPilotStates.bearingTurn;

        //targetBearing = new Vector3(x, y, z);

        SDegree toX = new SDegree(x - transform.rotation.eulerAngles.x);

        //var targetDir = transform.rotation.eulerAngles + targetBearing;



        deltaRotation = Quaternion.FromToRotation(transform.forward, targetBearing);
        toDirQ        = Quaternion.FromToRotation(Vector3.forward, targetBearing);
        toDir         = toDirQ.eulerAngles;
        DeltadirX     = toDir.x - transform.rotation.eulerAngles.x;
        DeltadirY     = toDir.y - transform.rotation.eulerAngles.y;
        DeltadirZ     = toDir.z - transform.rotation.eulerAngles.z;

        localAngularVelocity = GetComponent <Rigidbody>().transform.InverseTransformDirection(GetComponent <Rigidbody>().angularVelocity);

        float vax = localAngularVelocity.x;
        float vay = localAngularVelocity.y;
        float vaz = localAngularVelocity.z;
    }
Exemplo n.º 2
0
    public static SDegree operator -(SDegree a, float b)
    {
        var c = new SDegree(0);

        c.Angle = a.Angle - b;
        c.normalize();
        return(c);
    }
Exemplo n.º 3
0
    public static SDegree operator *(SDegree a, SDegree b)
    {
        var c = new SDegree(0);

        c.Angle = a.Angle * b.Angle;
        c.normalize();
        return(c);
    }