-
Hi everyone, I'm not sure if that's an issue, but I get different results with methods in question when trying to setup my camera orientation. I'm currently trying to make my own proof-of-concept vulkan renderer plugin for bevy, which uses Transform::compute_matrix for model matrices when rendering objects and setting up view matrix. When I try to use Transform::from_translation followed by Transform::looking_at to build my camera's transform, it produces an invalid matrix. I tried using Transform::from_matrix with Mat4::look_at_rh instead, that works fine for view matrix (objects are displayed correctly from camera point of view), but transform.translation becomes broken and contains nonsensical values. Here I setup three matrices and compare their values, third one being significantly different from expected: let camera_position = Vec3::new(
10.0
10.0,
10.0,
);
let m0 = Mat4::look_at_rh(camera_position, Vec3::ZERO, Vec3::Y);
let m1 = Mat4::look_at_lh(camera_position, Vec3::ZERO, Vec3::Y);
let m2 = Transform::from_translation(camera_position)
.looking_at(Vec3::ZERO, Vec3::Y)
.compute_matrix(); Can anyone please suggest if I'm doing anything wrong with transform setup? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I’ve noted previously that Mat4::look_at_rh and Transform::look_at seem to be inverses of each other but I don’t remember figuring out why to be able to fix it. |
Beta Was this translation helpful? Give feedback.
I’ve noted previously that Mat4::look_at_rh and Transform::look_at seem to be inverses of each other but I don’t remember figuring out why to be able to fix it.