unity官方资源包CarAIControl理解

    接上一篇,这篇讲AI控制。

using System;
using UnityEngine;
using UnityEngine.AI;
using Random = UnityEngine.Random;

namespace UnityStandardAssets.Vehicles.Car
{
    //添加关联脚本
    [RequireComponent(typeof (CarController))]
    public class CarAIControl : MonoBehaviour
    {
        //枚举刹车条件
        public enum BrakeCondition
        {
            NeverBrake,                 // the car simply accelerates at full throttle all the time.汽车一直以最高速度行驶
            //车会根据在朝着目标方向的即将发生的变化刹车,在转向时减速,在基于路线的AI
            TargetDirectionDifference,  // the car will brake according to the upcoming change in direction of the target. Useful for route-based AI, slowing for corners. 
            
            //车会在接近目标时刹车,不管目标的方向,对如果你想前往一个静止的目标,当到达那里时休息
            TargetDistance,             // the car will brake as it approaches its target, regardless of the target's direction. Useful if you want the car to
                                        // head for a stationary target and come to rest when it arrives there.
        }
        //该脚本以与用户控件脚本相同的方式为控制器提供输入,正因如此,它实际是“驾驶”汽车,没有特殊的物理和动画技巧,使得汽车的行为正常。
        // This script provides input to the car controller in the same way that the user control script does.
        // As such, it is really 'driving' the car, with no special physics or animation tricks to make the car behave properly.

        //“漫游”是用来给汽车一个更人性化,更少的机器人感觉。它们在向目标方向行驶时,速度和方向都有轻微的抖动。
        // "wandering" is used to give the cars a more human, less robotic feel. They can waver slightly
        // in speed and direction while driving towards their target.

        //[Range(0,1)]使得变量范围为0~1;
        //最谨慎的时候使用最大速度的百分比

        //[SerializeField] private BoxCollider Check;
        [SerializeField] [Range(0, 1)] private float m_CautiousSpeedFactor = 0.05f;               // percentage of max speed to use when being maximally cautious    
        //接近转弯的角度去当作保证最大的谨慎去处理
        [SerializeField] [Range(0, 180)] private float m_CautiousMaxAngle = 50f;                  // angle of approaching corner to treat as warranting maximum caution
        //最大安全距离
        [SerializeField] private float m_CautiousMaxDistance = 100f;                              // distance at which distance-based cautiousness begins
        //AI应该考虑它的角速度(例如旋转时放开加速度)谨慎使用
        [SerializeField] private float m_CautiousAngularVelocityFactor = 30f;   // how cautious the AI should be when considering its own current angular velocity (i.e. easing off acceleration if spinning!)
        //AI如何使用转向输入转向期望的方向。
        [SerializeField] private float m_SteerSensitivity = 0.05f;                                // how sensitively the AI uses steering input to turn to the desired direction
        //AI如何使用加速器达到当前所需的速度
        [SerializeField] private float m_AccelSensitivity = 0.04f;                                // How sensitively the AI uses the accelerator to reach the current desired speed
        //AI如何使用制动器达到当前所需的速度
        [SerializeField] private float m_BrakeSensitivity = 1f;                                   // How sensitively the AI uses the brake to reach the current desired speed
        //汽车将朝着目标的方向移动多远?
        [Ser
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Unity官方资源下载非常简单。首先,您需要打开Unity官方网站,网址为www.unity3d.com。在主页的顶部菜单栏上,您会看到一个"资源"选项。单击该选项,然后选择"资源"。这将带您到Unity资源下载页面。 在资源下载页面,您可以找到各种类型的资源括2D和3D艺术资源、动画资源、声音效果资源等等。您可以根据自己的需要选择下载。 一旦您找到了合适的资源,只需单击其名称或封面图像,然后就会显示它的详细信息页面。在此页面上,您可以查看有关资源的详细描述、功能、系统要求和其他详细信息。如果您确定要下载该资源,只需单击页面上的"下载"按钮即可开始下载。 Unity资源通常以压缩文件的形式提供,例如.zip或.unitypackage。一旦下载完成,您可以在计算机上选择一个位置来保存这个文件。 下载完成后,您可以打开Unity编辑器。在Unity编辑器的主界面中,选择"Assets"(资源)选项卡,然后选择"Import Package"(导入资源)。这将打开一个文件浏览器,您可以在其中找到并选择您之前下载的资源文件。单击"导入"按钮即可开始导入资源。 导入资源后,您就可以在Unity编辑器中使用这些资源了。您可以将它们拖动到场景或游戏对象中,使用它们创建游戏元素或进行其他操作。 总之,Unity官方资源下载非常简单。只需打开官方网站,找到适合您的资源并下载,然后在Unity编辑器中导入它们即可开始使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值