godot_recipes icon indicating copy to clipboard operation
godot_recipes copied to clipboard

Bug in the FPS Tutorial

Open JamesC01 opened this issue 3 years ago • 4 comments

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.

JamesC01 avatar Mar 15 '21 16:03 JamesC01

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

cbscribe avatar Mar 18 '21 01:03 cbscribe

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 avatar Mar 18 '21 12:03 JamesC01

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 avatar Mar 18 '21 12:03 JamesC01

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

JamesC01 avatar Mar 20 '21 09:03 JamesC01