kidscancode / godot_recipes

Lessons, tutorials, and guides for game development using the Godot game engine.
MIT License
239 stars 37 forks source link

Bug in the FPS Tutorial #86

Open JamesC01 opened 3 years ago

JamesC01 commented 3 years ago

Hi, there's a bug in the FPS tutorial. To move, it uses the camera's global_transform.basis, so if you look upwards, the player won't move as fast, and if you look straight up, you won't be able to move. It should use the kinematic body's (FPSCharacter) global_transform.basis, which gives typical FPS movement, and ignores the rotation of the camera. The video should also be updated.

Also a small recommendation: I'm new to godot, so this may be a bad suggestion, but when doing: rotation_helper.rotation.x = clamp(rotation_helper.rotation.x, -1.2, 1.2) I personally find it more understandable to use degrees: rotation_helper.rotation_degrees.x = clamp(rotation_helper.rotation_degrees.x, -90, 90) Maybe other's would agree too. It's just a bit easier to visualize.

cbscribe commented 3 years ago

Thanks for the suggestion - I'll update the recipe. Not so easy to update the video though...

JamesC01 commented 3 years ago

I suppose you could maybe reupload the video, with a small video added explaining the change, why and how it works etc., just before the bug is written. Not the cleanest solution, but easier than re-recording the entire thing.

From: Chris Bradfield Sent: 18 March 2021 01:37 To: kidscancode/godot_recipes Cc: James; Author Subject: Re: [kidscancode/godot_recipes] Bug in the FPS Tutorial (#86)

Thanks for the suggestion - I'll update the recipe. Not so easy to update the video though... — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

JamesC01 commented 3 years ago

Also, weird thing, using the transform of the player seems to get the exact same results as global_transform, and when I checked, they are both the same value. edit: actually, I think basis.x gets the body's right direction in world space, so it may make more sense to use transform.basis.x instead of global_transform.basis.x. I'm not really sure of the difference in this case. Maybe you know. edit: actually no, global_transform is better. transform seems to change if you change the rotation of the player's parent node, which is not right.

JamesC01 commented 3 years ago

A pinned comment on the video correcting the code would be good for the meantime. And a correction in the description.