Hello. my question concerns the addition of state charts. How can you immediately switch from a process state to another state without using send event? that is, immediately give the command to switch between states.
Here’s an example, my character is in an idle state, and if the floor collapses, I want him to go into a falling state. but I repeat - without using event sending. format “if something happened: then switch the state”
func _on_idle_state_physics_processing(delta):
if not is_on_floor():
# ?????????
velocity.y += grv * delta
By send event, do you mean signal? It’s definitely the recommended way to do something like this.
If you want to do it manually, underneath your collapsing floor you could have a area2d/3d and check every frame if the player position is inside the area. When the check comes back true, you can trigger your state switch.
If you’re using a animationtree, you could also make it so any time your player is falling downwards, you play the falling state. I recommend watching this video if that’s what you want to do.
I think he/she is not talking about signals, but an event sent from the StateChart (from this addon) using send_event()… is that correct @feersow ?
Back to the issue… could you elaborate why send_event() is not working for you in this case? could you have a separate event for this scenario like fall so the StateChart knows that it should change to fall state immediately?
UPDATE: I’ve checked the send_events code, is it becuase the events get queued?