Megafunk / MassSample

My understanding of Unreal Engine 5's experimental ECS plugin with a small sample project.
MIT License
681 stars 112 forks source link

How to change between two different behaviors? #61

Open javcalle opened 6 months ago

javcalle commented 6 months ago

Hello! This is not an issue, it is a question.

First of all, thanks for this documentation. It is the best one I have found about MassAI!

I am using massAI to simulate a crowd in a city. I want to have two different behaviours. The first should be a random walk, where the people follow a certain ZoneShape. And another one that is an escape path. When something happens, all pedestrians should leave their actual path and go to the escape path, increasing their speed. How can I do that?

After reading your documentation, I think I need to use a processor to change the ZoneGraph Navigation Trait's value and increase the speed value. But how can I trigger that? (Let's say that I want to trigger that change when I press the keyboard "P" button.). Can I create a BP function that makes the changes in the traits?

Is this the correct approach?

Thank you in advance!

Megafunk commented 5 months ago

This could be... just about anywhere! I don't have the City Sample on hand to check but it could be anything from a state transition in the statetree to just an if statement in a processor, or even a tag added by something else! I'm going to assume this uses a zonegraph annotation to create an area where zonegraph entities will switch to choosing a different movement target in the state tree and enter the "panic" state/tag, but my zonegraph knowledge is low