How to Rotate 2D Objects by Player Input ~ Godot 4 Tutorial
Chris' Tutorials
Here's my detailed explanation of rotating 2d objects in Godot by degrees or radians. Briefly touches how to use input actions to trigger the rotations on a Node2D (the root of the object you need rotated)
Watch out for tiny inaccuracies in floating point degree / radian conversions by checking with is_equal_approx!
Trying to Look At (Rotate Towards) at Player / Enemies? https://youtu.be/tX9yzjigV1k?si=DHceoZ0szx3d1rbt
Grid Building Plugin ➣ https://linktr.ee/gridbuilder World Time Plugin ➣ https://linktr.ee/worldtimeplugin Item Drops Plugin ➣ https://linktr.ee/itemdrops
➣ Downloadable Assets, Video Courses, and Other Places to Follow Me https://linktr.ee/ChrisTutorials https://ko-fi.com/christutorials https://patreon.com/christutorials https://chris-tutorials.itch.io/
➣ Support Channel with Crypto Donations https://pastebin.com/WAnBPcXs
00:00 - Demonstration 00:51 - Rotation Degrees Output 01:28 - Rotation & Input Code 03:25 - Simplest Degrees Rotation Solution (tl;dw) 05:21 - Floating Point Conversions in Rotations 07:32 - GUT Godot Unit Test 07:40 - Rotating with Radians 10:12 - Look At (Video in Description) 11:00 - Why global_rotation_degrees? 11:31 - Wrapup ... https://www.youtube.com/watch?v=cLCbqW-mdEA
46043701 Bytes