Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Thank you! I will say, there were a LOT of physics-based movement ideas that we also could not get to work in Godot, which is why movement ended up being pretty simpleminded except for the rotation. But for the rotation itself, we went through some steps to turn the mouse position into an amount of torque to apply to the player RigidBody2D.

1. Got a target rotation angle based on mouse position

2. Computed the difference with the current rotation angle

3. Computed a target angular velocity as the angle difference divided by an arbitrary 0.2 (in theory, the number of seconds we want it to take to rotate that amount)

4. Computed a target angular acceleration as the difference between the current angular velocity and the target angular velocity, divided by an arbitrary 0.1 (in theory, the number of seconds it should take to reach the target velocity)

5. Computed the torque to be applied as the target acceleration times the inertia (which is one of those invisible properties of RigidBody2D you can just use anywhere)

This is the code for that: https://github.com/its-dlh/brackeys-2023.2/blob/final-1/Player/RigidBody.gd

That actually makes a ton of sense!

I've been trying to get slow rotation to work on character bodies, it never occurred to me to use a rigid body.

Thanks!