Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Camera shifting Bug #250

Merged
merged 1 commit into from
Dec 6, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ fn main() {
xz_forward = vec3_normalized(xz_forward);
camera.position = vec3_add(
camera.position,
vec3_scale(xz_forward, 0.1)
vec3_scale(xz_forward, 0.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait... what?! Wouldn't this remove xz_forward's effect completely? Then you should've just removed the whole vec3_add.
But there must be a reason I did this... Maybe I found it in Minecraft's source, although I doubt that.

Oh, you know what it is? It's the distance from the center of the feet to the "eye sockets".
So, yeah, this is not fixing the bug, but rather removing a feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except it causes the bug because the camera height shouldn't be determined by camera/ movement (which is why the bug happens, but should happen here 211/212)

let mut camera = first_person.camera(0.0);
                camera.position[1] += 1.62;

but instead add it to 1.62 + players position

);

let view_mat = camera.orthogonal();
Expand Down