Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve movement in examples #210

Merged
merged 5 commits into from
Oct 29, 2023
Merged

Improve movement in examples #210

merged 5 commits into from
Oct 29, 2023

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Oct 29, 2023

Objective

Fixes #170.

Currently, the movement in examples like move_marbles and cubes is frame rate dependent because they are running in Update but don't use delta time. basic_dynamic_character and basic_kinematic_character on the other hand run in the PhysicsSchedule, but this can cause issues with missed inputs as reported in #170.

The character controllers are also perhaps too basic and don't reflect real usage well, and the movement code isn't great and it doesn't support WASD.

Solution

  • Put all movement systems in Update and use delta time (alternatively, you could send input events in Update and have another system handle the movement in the PhysicsSchedule)
  • Refactor input handling to be cleaner and to support WASD as well as arrow keys
  • Refactor character controller examples with CharacterControllerBundle and configuration options
  • Fix some meshes not being rendered due to clone_weak

@Jondolf Jondolf added the C-Examples Improvements or additions to examples label Oct 29, 2023
@Jondolf Jondolf merged commit f087a03 into main Oct 29, 2023
4 checks passed
@Jondolf Jondolf deleted the improve-examples branch October 29, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Examples Improvements or additions to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

keyboard_input.just_pressed in basic_dynamic_character example works only sometimes
1 participant