hey all, google hasn’t been a help cause I am not sure the name of the component I am after, basically I am trying to make a zone where when you are inside it you have a change to a variable.
more exact I am trying to make a sand area that if you are standing on sand your speed is reduced to 80% and in water 50%. I know there is ‘swimming’ but I want to do it this way to have other effects
One way is to create actor with simple box collision component. Add some enumeration in it, for example - EZoneType (Water, Sand, Mud, etc…)
Then check when this box is overlapped by player character, and adjust player’s movement component values (max walk speed, max acceleration, etc) to desired depending on EZoneType.
Another way is to use physical materials. Check on what material character standing for now and also adjust player’s movement component values.
I was thinking the enumeration with a box collision, however when I check is overlapped, if I tap the next zone, then walk back into the zone I’m already in (e.g. standing on sand, tap water, head back into sand) I would have the water effect in sand, or should I check ever frame what box I’m in? if so how do I do that as when I was looking before for something like that I couldn’t find a way to do that either.
Thanks for your help so far.
I think it should be checked every frame.
Also you can use some priority of boxes. Just as simple value. So you get every overlapped box, sort them by priority parameter and use one with higher.
that sounds good, how do you get the box? just an array of boxes as a player variable? or is there a better way to check using blueprints? I’m not used to using engines.
In “boxes” I mean some actor with box collision component. Some ZoneActor.
When player character overlapped by something you need to check is it ZoneActor. Then add it to array of zone actors which overlapping character for now.
I think it’s better to use GetOverlappedActors in here.
When you have more than one zone actor in that array, you should get priority value by every zone and compare them. Actor with biggest priority will become as “current zone”.
This is kind of quick solution for your purpose.
More advanced and universal way is to implement physical materials.