Skip to content

[feat] Acceleration and Flipping Gravity#100

Open
blunt-axe wants to merge 2 commits intoYao-class-cpp-studio:mainfrom
blunt-axe:add_keys
Open

[feat] Acceleration and Flipping Gravity#100
blunt-axe wants to merge 2 commits intoYao-class-cpp-studio:mainfrom
blunt-axe:add_keys

Conversation

@blunt-axe
Copy link

New keys are added:
[x]: The ball rotation has 1.5x acceleration when holding
[c]: Flip the ball's gravity

@blunt-axe blunt-axe closed this Jan 19, 2024
@blunt-axe blunt-axe reopened this Jan 19, 2024
@blunt-axe
Copy link
Author

However, my implementation for flipping gravity has some limitations.

The "glfwGetKey" function is rarely consecutive when holding a key. So, for every rigid body (src/GameX/physics/rigid_body.h), I choose to ignore the "flip gravity" signals which are too close to the last signal (precisely, less than 1/8 seconds). And I added a variable in every rigid body, representing the time lapsed since the last "flip gravity" input.

If there are better implementations, you may replace this one.

1 similar comment
@blunt-axe
Copy link
Author

However, my implementation for flipping gravity has some limitations.

The "glfwGetKey" function is rarely consecutive when holding a key. So, for every rigid body (src/GameX/physics/rigid_body.h), I choose to ignore the "flip gravity" signals which are too close to the last signal (precisely, less than 1/8 seconds). And I added a variable in every rigid body, representing the time lapsed since the last "flip gravity" input.

If there are better implementations, you may replace this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant