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

A way to update HSM in both idle and physics process. #165

Open
hayahane opened this issue Jul 24, 2024 · 1 comment
Open

A way to update HSM in both idle and physics process. #165

hayahane opened this issue Jul 24, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@hayahane
Copy link

Problem statement

I'm trying to use LimboHSM for not only AI but character controller. I usually expect a state to update like:

  • Idle Process: get input and caching; deal with animation; (things requires related to graphics or something happens in every frame)
  • PhysicsProcess: deal with physics like character movement.
    (I'm a unity refugee, so if that's not how usually we do in godot, plz tell me)
    But in LimboHSM, there seems to be only one kind of processing.

Proposed solution

  • Add a virtual function _physics_update()
  • Add a option to update both.

Alternatives

Don't know.

@hayahane hayahane added the enhancement New feature or request label Jul 24, 2024
@limbonaut
Copy link
Owner

limbonaut commented Jul 31, 2024

LimboHSM only supports a single update function in its implementation. It's not specific to any particular update time. In update_mode, you can specify when the state machine should be updated, and you can choose between idle process or physics process, or opt to update it manually. Some folks reported, that they were using manual update to reduce the rate at which agents update when off-screen.
Since the _update function is not equal to idle update (it's not even the default), it won't be a good solution to simply add _physics_update on top of this system. I don't particularly see how we could support two separate update functions in the system described above.
I wanted to say that you could potentially use _process_input for that, but it looks like it's currently bugged, and I'm in the process of fixing it. _process_input should be automatically enabled/disabled when substate becomes active, but that will come in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants