deltaphc / raylib-rs

Rust bindings for raylib
Other
715 stars 123 forks source link

Bug in `Quaternion::from_vec3_pair` #167

Closed shastro closed 9 months ago

shastro commented 9 months ago

It appears to me that there was a small typo in the definition in of this function. It reads:

/// Returns quaternion based on the rotation from one vector to another.
pub fn from_vec3_pair(from: Vector3, to: Vector3) -> Quaternion {
    let cross = from.cross(to);
    Quaternion {
        x: cross.x,
        y: cross.y,
        z: cross.y,
        w: 1.0 + from.dot(to),
    }
    .normalized()
}

Notice that the z component uses cross.y instead of cross.z.