官术网_书友最值得收藏!

Group steering

Group steering can be broken down into three main steering behaviors: alignment, cohesion, and separation. An alignment steering force has the agent's face in the same forward direction as the rest of the agents in the group. Cohesion is a force that keeps the agents within the group together. Separation is the opposite of cohesion and forces the agents within the group to keep minimum distance from one another.

Using a combination of these three steering behaviors, which are also known as flocking, you can create groups of agents that are driven to move together yet not run into each other.

Alignment

To calculate a steering vector that will align our agent to a group of other agents, we can use the ForceToSeparate function.

local forceToAlign =
    agent:ForceToSeparate(maxDistance, maxAngle, agents);

Cohesion

To keep our agent together with a group of other agents, we can calculate a steering force for combining using the ForceToCombine function.

local forceToCombine =
    agent:ForceToCombine(maxDistance, maxAngle, agents);

Separation

To keep our agent apart from a group of other agents, we can use the ForceToSeparate function.

local forceToSeparate =
    agent:forceToSeparate(minDistance, maxAngle, agents);
主站蜘蛛池模板: 额尔古纳市| 龙川县| 红安县| 华亭县| 平昌县| 延长县| 夏邑县| 乌拉特前旗| 张家口市| 石林| 神木县| 溆浦县| 鱼台县| 资溪县| 德惠市| 丽江市| 临夏县| 安徽省| 乌鲁木齐县| 嘉祥县| 富民县| 鹰潭市| 信宜市| 江安县| 绥德县| 兰坪| 板桥市| 南涧| 昌黎县| 上蔡县| 冷水江市| 苏尼特左旗| 池州市| 沁阳市| 宜黄县| 新民市| 怀安县| 涿州市| 凤翔县| 广州市| 土默特左旗|