Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Use new_observer_frame in Transform::look_at #1142
Make the forward vector of and entity to point towards position (See #1134) when using Transform::look_at, as per the documentation. In particular, for a camera:
should point the camera towards point, as in Unity's Transform.LookAt example:
I have an example that demonstrates this change here:
you can switch between my branch and current amethyst master in Cargo.toml and see how the camera behavior changes.
We could also have a separate function that has the new behavior with a different name, as suggested in the issue thread, but I think the above is likely going to be the expected behavior of look_at, and matches other game engines.
I should probably note that what I meant with the new function name was to remove the old one entirely and just have the new one. That way people who used the function before will get compile errors since the behavior was incorrect in cgmath too. Then there's also the confusion between nalgebra and amethyst that occurs if it's kept this way which is probably the most important reason to rename it.
I changed the name of the function to face_towards as suggested. Since the name changed I also updated the changelog.
I also checked the example in the comment for the function and made sure it works. I also added a little extra using move_forward after face_towards because that might be more helpful to people that the existing rotation_between example.