this post was submitted on 01 Oct 2023
10 points (100.0% liked)

Godot

5689 readers
5 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

[email protected]

Credits

founded 1 year ago
MODERATORS
10
submitted 11 months ago* (last edited 11 months ago) by [email protected] to c/[email protected]
 

So, I'm trying to rotate the player as they turn left and right in a top down view. The rotation works correctly when moving right, but fails going left.

Here's the code that handles the rotation

rotation = move_toward(rotation, PI / 12 * direction.x, PI / 2 * direction.x * delta)

The numerical values look right, giving me 0.261 rads going right and -0.261 rads going left ... but the rotation going left continues to go clockwise and stops just before a full 180.

Is there some quirk with rotation that I'm missing? My rubber ducks have remained silent.

top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 9 points 11 months ago (1 children)

Took a walk and figured out my issue. I shouldn't have used direction.x in the increments argument. move_toward figures that out for you.

[–] [email protected] 9 points 11 months ago (1 children)

Way to not just say "nevermind fixed it"

[–] [email protected] 4 points 11 months ago

It has always sounded to me that that line is from people annoyed because they didn't get an answer. And I don't believe they figured anything out.