I'm having some trouble with the rotate() function so far, so I would love to hear another way to rotate my CharacterBody2D

Godot Version

4.2.1

Question

Which method can I use to rotate my CharacterBody2D (except using the rotate() function)?

Body

I am having some trouble recently with the rotate(rotation_speed) method and I believe it doesn’t work. My Character starts spinning at 1000 kph when I just set my “rotation_speed” variable to 1. Is there any other way to rotate my Character without going crazy :grey_question:

There is an option to change the rotation variable, but there are some pitfalls there

rotate() works with radians.

By calling it with a parameter of “1” you rotating your object 57.3 degrees per frame, or 3438 degrees per second.

1 Like

Holy moly! I tried to set the variable to 0.1 but it didn’t work. It stopped rotating.

Solution

var rotation_direction = int()

func get_input():
	rotation_direction = Input.get_axis("left", "right")

Credits

With the help of the docs: 2D movement overview — Godot Engine (stable) documentation in English
And the help of @Exerion

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.