-
Notifications
You must be signed in to change notification settings - Fork 0
KAIMoveParams
This is a struct that can serve two purposes:
- Passing optional detailed movement parameters for custom chase functions, without needing to add a dozen more parameters to said functions.
- This is both for KAI_MoveTowards() and KAI_MoveAway().
- Making KAI_MoveAway() use its' corner checking and obstacle avoidance features, along with configuring said features.
Note: If you're confused, here's a rule of thumb. If the variables in the first two categories are name identically to ones in KAI_MoveTowards() and/or KAI_MoveAway(), use them to pass parameters to those two. The variables the struct contains are split in three categories:
Variables used to pass more detailed movement logic for custom chase functions, particular for moving towards an actor or position. (Passed to KAI_MoveTowards() calls)
Type: Vector3 The position for the actor to move to. Also used if this struct is used to pass parameters to KAI_MoveAway(), to make it move away from a position instead of actor.
Type: Double A multiplier for how many steps the caller can take around an obstacle before heading straight to the TargetPos again.
Type: Double How much the actor can turn per step to face the position it's moving to.
Type: Int The A_Chase() flags to pass to KAI_MoveTowards(). Used both for passing params with this struct to KAI_MoveTowards() and KAI_MoveAway().
Type: Int The KAI_MoveTowards() flags to pass.
Ditto, but for moving AWAY. (Passed to KAI_MoveAway() calls)
Type: Pointer The actor to move away from.
Type: Int How many positions to try per next position to run away to picked. i.e at 32, it will generate 32 points around the actor to run from, and pick the furthest (From what the actor is running from) reachable point to go to
Type: Double The radius around which to generate potential points to run away to.
Type: Int How many steps to take towards the next position to run, before giving up and generating another position away from the actor/position to run to.
Type: Int The KAI_MoveAway() flags to pass.
Variables used to specify to KAI_MoveAway() that it should use its' corner check and obstacle avoidance features, and how to do so.
Type: Double How far away from the caller to check to their left and right for a corner to run behind.
Type: Int How many checks should the corner check be split by? For example, with a CornerDist of 128, if CornerDiv is 8, it will check every 8 map units to the left and right of the caller for a position that is not directly visible or reachable by whatever actor or position the caller is running from. And pick the closest check that returns true to run to.
Type: Double How many map units in front of the caller to check for obstacles.
Type: Int How many slices around the actor should the code check for obstacles? i.e when set to 16, it'll fire 16 checks in a 360 degree radius, every 22.5 degrees, and pick the first clear check (No obstacles hit) as the position to walk to.
Here is an example of a _KAI_LandVehicleChase() call in a vehicles' See state. With detailed parameters passed to fine tune the movement.
MoveToParams Params;
Params.DetourFactor = 0.8;
Params.Attempts = 32;
Params.StepThreshold = 32;
Params.RunRad = 384;
KAI_LandVehicleChase ("Spawn",LVC_ATTACKWHENSCARED,turnradius:8,384,Params);
- Home
- Features
- Classes
- Functions
- Guides