normalize the resulting re-calculated "up" vector
This commit is contained in:
parent
c3c6f1338d
commit
fbba97f168
|
@ -255,7 +255,7 @@ impl Matrix4x4 {
|
||||||
pub fn new_look_at(position: &Vector3, target: &Vector3, up: &Vector3) -> Matrix4x4 {
|
pub fn new_look_at(position: &Vector3, target: &Vector3, up: &Vector3) -> Matrix4x4 {
|
||||||
let forward = (*target - *position).normalize();
|
let forward = (*target - *position).normalize();
|
||||||
let left = forward.cross(up).normalize();
|
let left = forward.cross(up).normalize();
|
||||||
let up = left.cross(&forward);
|
let up = left.cross(&forward).normalize();
|
||||||
|
|
||||||
let out = Matrix4x4::new(
|
let out = Matrix4x4::new(
|
||||||
left.x, left.y, left.z, 0.0,
|
left.x, left.y, left.z, 0.0,
|
||||||
|
|
Loading…
Reference in a new issue