-
Notifications
You must be signed in to change notification settings - Fork 105
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
Conversation
See Bug: PistonDevelopers#201 Fixed Camera X/Y changing when Pitch/Yaw is at Min and max
Thanks! |
@RichardlL You can write "Closes " or "Fixes " in the commend and Github will automatically close the issue. |
Good catch! |
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
O.k. It looks like vec3_scales in piston are used for calculating angle for viewing sometime, respective of camera position . (Like if you had a moon and you always wanted the moons face looking at the earth) or vise versa. In minecraft we don't use this, as camera angle isn't dependent on movement and movement isn't dependent on on camera angle e.g. We don't need this in minecraft, as camera is not dependent on movement The camera's y should be set 1.62 above the players y position. (assuming that's its feet) What makes it even more confusing is it seems x and y in piston for camera position, so @eddyb is right, the whole thing is unneeded. **So what seems what was happening
So put in layman's terms... The camera is moving forwards when looking down, or backwards when looking up. This is used in places with orbiting, such as 3rd person. For first person, this shouldn't happen at all, since the players eyes are centered, and where not staring at something .1 meters in front of us. If you change the value to 5 (from 0.1), it puts you in " third person", you're orbiting your players postion in 3rd person, and that eliminates the rounding problem. This is how third person in minecraft works, as the camera is just orbiting 1.62 above your position instead of being 1.62 above your location, and your body is rendered too. Changing this to 0.0 fixes the bug due to nullifying the effects entirely. Deleting this doesn't remove the feature, it only removes the bug. Camera XYY should be players X, Y+1.62 ,Z. This doesn't do that, it makes the camera orbit something .1 meters away from the player |
See Bug: #201
Fixed Camera X/Y changing when Pitch/Yaw is at Min and max