Example #1
0
        public void set_look_at(Vector3 eye, Vector3 target, Vector3 up)
        {
            // Make rotation matrix
            // Z vector
            Vector3 zAxis = eye - target;

            zAxis.normalize();

            Vector3 yAxis = up;

            Vector3 xAxis = yAxis.cross(zAxis);

            // Recompute Y = Z cross X
            yAxis = zAxis.cross(xAxis);

            xAxis.normalize();
            yAxis.normalize();

            basis = Basis.create_from_axes(xAxis, yAxis, zAxis);

            origin = eye;
        }
Example #2
0
 public Transform(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 origin)
 {
     this.basis  = Basis.create_from_axes(xAxis, yAxis, zAxis);
     this.origin = origin;
 }