返回介绍

NavMeshAgent.velocity 速度

发布于 2019-12-18 15:38:06 字数 2484 浏览 1595 评论 0 收藏 0

JavaScript => public var velocity: Vector3;
C# => public Vector3 velocity;

Description 描述

Access the current velocity of the NavMeshAgent component, or set a velocity to control the agent manually.

使用NavMeshAgent 组件的当前速度,或者手动设置速度去控制代理。

Reading the variable will return the current velocity of the agent based on the crowd simulation.

读取该变量将返回基于人群仿真代理的当前速度。

Setting the variable will override the simulation (including: moving towards destination, collision avoidance, and acceleration control) and command the NavMesh Agent to move using the specific velocity directly. When the agent is controlled using a velocity, its movement is still constrained on the NavMesh.

设置变量将会重载模拟仿真(包括:朝目的地移动,碰撞躲避,和加速度控制)和命令导航网格代理直接使用指定速度移动。当代理被速度控制时,它的运动依然在导航网格上。

Setting the velocity directly, can be used for implementing player characters, which are moving on NavMesh and affecting the rest of the simulated crowd. In addition, setting priority to high (a small value is higher priority), will make other simulated agents to avoid the player controlled agent even more eagerly.

直接设置速度,可以用于执行玩家特性,该玩家在导航网格上移动并影响模拟人群的剩余部分。另外,将优先级设置为高 (较小的值优先级更高),将使其他模拟的代理甚至更急切地避免玩家控制代理。

It is recommended to set the velocity each frame when controlling the agent manually, and if releasing the control to the simulation, set the velocity to zero. If agent’s velocity is set to some value and then stopped updating it, the simulation will pick up from there and the agent will slowly decelerate (assuming no destination is set).

它推荐手动控制代理时每帧设置速度,并且如果释放控制仿真,设置速度为0。如果代理的速度设置为某个值并且停止更新它,该模拟将会从这儿获取并且缓慢降低速度(假设没有设置目的地)。

Note that reading the velocity will always return value from the simulation. If you set the value, the effect will show up in the next update. Since the returned velocity comes from the simulation (including avoidance and collision handling), it can be different than the one you set.

注意读取速度将总会从模拟返回。如果你设置该值,该效果将会在下次更新中显示。因为返回的速度来自模拟(包括躲避和碰撞处理),它可以与你设置的速度不同。

The velocity is specified in distance units per second (same as physics), and represented in global coordinate system.

在距离单位中指定的单位是每秒(和物理上一样),并且在全局坐标系统中。

navmeshagent

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文