Ejemplo n.º 1
0
        public void SetLookAt(GodotVector3 eye, GodotVector3 target, GodotVector3 up)
        {
            GodotVector3 vector3_1 = eye - target;

            vector3_1.Normalize();
            GodotVector3 vector3_2 = up.Cross(vector3_1);
            GodotVector3 yAxis     = vector3_1.Cross(vector3_2);

            vector3_2.Normalize();
            yAxis.Normalize();
            basis  = GodotBasis.CreateFromAxes(vector3_2, yAxis, vector3_1);
            origin = eye;
        }
Ejemplo n.º 2
0
        public GodotBasis Orthonormalized()
        {
            GodotVector3 axis1 = GetAxis(0);
            GodotVector3 axis2 = GetAxis(1);
            GodotVector3 axis3 = GetAxis(2);

            axis1.Normalize();
            GodotVector3 yAxis = axis2 - (axis1 * axis1.Dot(axis2));

            yAxis.Normalize();
            GodotVector3 zAxis = axis3 - (axis1 * axis1.Dot(axis3)) - (yAxis * yAxis.Dot(axis3));

            zAxis.Normalize();
            return(CreateFromAxes(axis1, yAxis, zAxis));
        }
Ejemplo n.º 3
0
 public GodotPlane(GodotVector3 v1, GodotVector3 v2, GodotVector3 v3)
 {
     normal = (v1 - v3).Cross(v1 - v2);
     normal.Normalize();
     d = normal.Dot(v1);
 }