pub fn look_at(position: Vector3, look: Vector3, up: Vector3) -> Matrix4 {
        // forward points away from the look direction
        let forward = (position - look).normalized();
        let left = Vector3::cross(forward, up.normalized()).normalized();
        let new_up = Vector3::cross(forward, left);

        Matrix4 {data: [[left.x, new_up.x, forward.x, -Vector3::dot(left, position)],
                        [left.y, new_up.y, forward.y, -Vector3::dot(new_up, position)],
                        [left.z, new_up.z, forward.z, -Vector3::dot(forward, position)],
                        [    0.0,     0.0,       0.0,                              1.0]]}
    }
/// Returns a look at matrix that looks from `position` to `look`.
Returns a look at matrix that looks from `position` to `look`.
Returns a look at matrix that looks from ` position ` to ` look ` .
pub fn look_at(position: Vector3, look: Vector3, up: Vector3) -> Matrix4 {
        // forward points away from the look direction
        let forward = (position - look).normalized();
        let left = Vector3::cross(forward, up.normalized()).normalized();
        let new_up = Vector3::cross(forward, left);
        Matrix4 {data: [[left.x, new_up.x, forward.x, -Vector3::dot(left, position)],
                        [left.y, new_up.y, forward.y, -Vector3::dot(new_up, position)],
                        [left.z, new_up.z, forward.z, -Vector3::dot(forward, position)],
                        [    0.0,     0.0,       0.0,                              1.0]]}
    }
pub fn look_at ( position : Vector3 , look : Vector3 , up : Vector3 ) -> Matrix4 { // forward points away from the look direction let forward = ( position - look ) . normalized ( ) ; let left = Vector3 :: cross ( forward , up . normalized ( ) ) . normalized ( ) ; let new_up = Vector3 :: cross ( forward , left ) ; Matrix4 { data : [ [ left . x , new_up . x , forward . x , - Vector3 :: dot ( left , position ) ] , [ left . y , new_up . y , forward . y , - Vector3 :: dot ( new_up , position ) ] , [ left . z , new_up . z , forward . z , - Vector3 :: dot ( forward , position ) ] , [ 0.0 , 0.0 , 0.0 , 1.0 ] ] } }
Returns a look at matrix that looks from `position` to `look`.
Returns a look at matrix that looks from ` position ` to ` look ` .
position
Vector3
look
Vector3
up
Vector3
position
Vector3
look
Vector3
up
Vector3