Unity3D 人工智能(一)群组行为
来源:互联网 发布:深圳行知小学校园网 编辑:程序博客网 时间:2024/06/05 10:59
1,群组行为的介绍,不使用群组行为算法的样子
导入一个乌鸦模型 乌鸦模型 。。链接: https://pan.baidu.com/s/1kV9TPY3 密码: zg7u
using System.Collections;using System.Collections.Generic;using UnityEngine;public class Crow : MonoBehaviour { public Transform target; //向目标飞行 public float speed = 1; //1, public Vector3 velocity = Vector3.forward; //向前方 public float animRandmTime=2f; private Animation anim; private IEnumerator Start() { target = GameObject.Find("target").transform; anim = GetComponentInChildren<Animation>(); yield return new WaitForSeconds(Random.Range(0, animRandmTime) ); Debug.Log(Random.Range(0, animRandmTime)); anim.Play(); }void Update () { // 1, transform.Translate(velocity * Time.deltaTime, Space.World); transform.LookAt(target.position); transform.Translate(Vector3.forward*Time.deltaTime*speed);}}
2, 分离 队列 聚集
分离: 鸟A和鸟B靠太近会分开
队列: 鸟群正在飞行。 意思就是跟着大部队走
聚集: 既不能脱离部队太远又不能靠的太近
如图所示
3,牛顿第二定律
1,速度v
2,加速度a (例: 3m/s² 最开始是2m , 5m,8m)
3,质量m
4,牛顿第二定律F=m*a (反推 a=F/m)
F为受到的力
4,得到最近的乌鸦 游戏物体的集合
阅读全文
0 0
- Unity3D 人工智能(一)群组行为
- unity3d AI 学习--群组行为
- 人工智能笔记(一)
- 行为模式(一)
- MMORPG游戏的人工智能(AI)和行为树设计
- MMORPG游戏的人工智能(AI)和行为树设计
- 游戏中的人工智能(AI)和行为树科普
- UnityAI行为------群组行为
- 人工智能学习笔记(一)
- 人工智能笔记系列(一)
- 人工智能实践教程(一)
- 游戏中的人工智能(一)
- 行为型模式(一)
- 行为型模式(一)
- 行为型模式(一)
- 游戏开发中的人工智能(一):游戏人工智能简介
- unity3d学习(一)
- 漫话Unity3D(一)
- css中使得border渐变方法
- nmt初探
- 生活小记14
- Sql数据库
- 卡耐基-梅隆大学的编程难题
- Unity3D 人工智能(一)群组行为
- Maven快速搭建SpringMVC项目
- Apache配置网站根目录
- 获取C++11 变参模板的参数数量
- Apache配置虚拟域名
- jQuery学习笔记(一)——jQuery选择器(全)
- 新闻清除缓存
- 计算图片缓存大小
- 构造器和继承体系