Unity 2019.3中的物理更新

Unity 2019.3 beta brings quite a few updates to our PhysX integration. This will make the current implementation more precise, faster, and more robust.

Unity 2019.3 Beta为我们的PhysX集成带来了许多更新。 这将使当前的实现更加精确,更快和更可靠。

We’ve upgraded the PhysX library to PhysX 4.1 from PhysX 3.4. For more information, see the section “Migrating from PhysX SDK 3.4 to 4.0” in NVIDIA’s PhysX 4.1 SDK Guide.

我们已经将PhysX库从PhysX 3.4升级到了PhysX 4.1。 有关更多信息,请参见《 NVIDIA PhysX 4.1 SDK指南 》中的“从PhysX SDK 3.4迁移到4.0”部分 。

新求解器类型 (New solver type)

We exposed a new solver type in 2019.3, which is called Temporal Gauss-Seidel. It’s available under Edit > Project Settings, in the Physics category. With this new solver type, joints tend to be more resistant to overstretching and various glitches.

我们在2019.3中公开了一种新的求解器类型,称为Temporal Gauss-Seidel。 在“物理”类别中的 编辑” >“ 项目设置”下 ,该功能 可用 。 使用这种新的求解器类型,关节往往更耐过度拉伸和各种毛刺。

新型宽相型 (New broad-phase type)

We also exposed a new broad-phase algorithm, which is called Automatic Box Pruning. It’s similar to the Multibox Pruning algorithm that’s been available for a while but it can compute the world boundaries and amount of subdivisions automatically. It will maintain the set of grid cells and use the regular Sweep And Prune approach to work out potentially overlapping pairs of colliders. This is intended to help with big scenes where a single Sweep And Prune would be producing lots of extra false positives. This mode is the default broad-phase in PhysX 4.1, but we chose to be conservative and keep it disabled by default. If you want to try it out, enable it in the Physics settings under Broadphase Type.

我们还公开了一种新的广义阶段算法,称为自动Box修剪 。 它类似于已经使用了一段时间的Multibox Pruning算法,但是它可以自动计算世界边界和细分数量。 它将维护网格单元集,并使用常规的“扫掠和修剪”方法来计算可能重叠的对撞机。 这是为了帮助处理大型场景,其中单个Sweep And Prune会产生很多额外的误报。 此模式是PhysX 4.1中的默认宽相模式,但我们选择了保守模式,并默认将其禁用。 如果您想尝试一下,请在Broadphase Type下的Physics设置中启用它。

新的中期 (New mid-phase)

Mid-phase is a set of data structures as well as a set of algorithms. These algorithms pick a small set of potentially intersecting triangles of a mesh whenever you run a physics query or when a collider is close to the surface of a mesh. The idea is that a mesh may have a large number of triangles and you don’t want to be running precise checks for each of them, so we build an acceleration structure that allows the algorithm to pick only a small subset that is worth checking.

中间阶段是一组数据结构以及一组算法。 每当您运行物理查询或对撞机靠近网格表面时,这些算法都会选择网格的一小部分可能相交的三角形。 这个想法是,网格可能包含大量三角形,并且您不想对每个三角形进行精确检查,因此我们构建了一个加速结构,允许该算法仅选择值得检查的一小部分子集。

This acceleration structure is built during the mesh baking for physics, which normally happens when you instantiate the MeshCollider component and assign it its sharedMesh property. Building that structure can take quite a bit of time, and it makes sense to minimize it. The majority of the time spent during this process in older PhysX versions was in constructing the R-Trees.

此加速结构是在物理的网格烘焙过程中构建的,通常在实例化MeshCollider组件并将其分配给它的sharedMesh属性时发生。 构建该结构可能需要花费大量时间,因此将其最小化是有意义的。 在较旧的PhysX版本中,此过程花费的大部分时间是在构造R树中。

PhysX 4.1 has a new algorithm in place that doesn’t require any R-Trees. However, the downside is that it can currently only run on Windows, Mac and Linux targets. It is automatically used on Desktop platforms but can be disabled per MeshCollider in the Cooking Options drop-down menu. On unsupported platforms, it will automatically fall back on the old mid-phase algorithm.

PhysX 4.1采用了新算法,不需要任何R树。 但是,缺点是它目前只能在Windows,Mac和Linux目标上运行。 它会在桌面平台上自动使用,但可以根据“ 烹饪选项” 下拉菜单 中的MeshCollider禁用 。 在不受支持的平台上,它将自动使用旧的中间阶段算法。

延迟和多线程网格烘焙 (Delayed and multi-threaded mesh baking)

As we mentioned before, instantiating a new MeshCollider can take time. Now you can pre-bake a Mesh instance for usage with the MeshCollider using the Physics.BakeMesh function. You can hide the computationally intense mesh-baking process behind a loading screen or transition scenes, like a dialog scene in an adventure game or a cut-scene.

如前所述,实例化一个新的MeshCollider可能要花费一些时间。 现在,您可以使用Physics.BakeMesh函数预烘焙Mesh实例,以用于MeshCollider。 您可以将计算量大的网格烘焙过程隐藏在加载屏幕或过渡场景(例如冒险游戏或动画场景中的对话场景)后面。

An interesting side effect of this function is that you can actually call it from off the main thread, and thereby spread the baking load across all of the available cores. Check the docs for an example of how to use it with the C# Job System.

此函数的一个有趣的副作用是,您实际上可以从主线程中调用它,从而将烘烤负载分散到所有可用核心上。 检查文档以获取有关如何在C#Job System中使用它的示例。

Exposing a thread-safe Physics.BakePhysicsMesh(meshInstanceId, isConvex) function to bake the data for MeshCollider on-demand from any thread. Usage example with C# job system (generate N meshes and bake off the main thread): https://t.co/vWIQ64yVqG pic.twitter.com/wsHHsD9Rsx

公开一个线程安全的Physics.BakePhysicsMesh(meshInstanceId,isConvex)函数以从任何线程按需烘焙MeshCollider的数据。 C#作业系统的用法示例(生成N个网格并烘烤主线程): https: //t.co/vWIQ64yVqG pic.twitter.com/wsHHsD9Rsx

— Anthony Yakovlev (@AnthonyYakovlev) April 15, 2019

-Anthony Yakovlev(@AnthonyYakovlev) 2019年4月15日

删除了TerrainCollider厚度和统一高度图设置 (Removed TerrainCollider thickness and Unified Heightmaps setting)

Back in Unity 2018.3, we switched to a more robust contact generation path for TerrainCollider, and changed the contacts generation algorithm. Instead of using a special path to handle the heightmap geometry when computing contacts, this newer algorithm treats a portion of the heightmap in contact as a mesh and utilizes the regular mesh contacts generation code. However, we kept the old code around, and it was still available in the physics settings as the Enable Unified Heightmaps option.

回到Unity 2018.3,我们切换到TerrainCollider的更强大的联系人生成路径,并更改了联系人生成算法。 这种新算法无需在计算接触时使用特殊路径来处理高度图的几何图形,而是将接触中的一部分高度图视为网格,并利用常规的网格接触生成代码。 但是,我们保留了旧代码,并且在物理设置中仍然可以使用“ 启用统一高度图”选项来使用它。

The update to PhysX 4.1 removes the Enable Unified Heightmaps option. On top of that, we’re also removing the thickness setting that was available in the Terrain component properties. Terrain thickness was intended to solve the tunneling effect, where fast moving objects would pass through the terrain surface undetected. Now that thickness is gone, we recommended that you use Continuous Collision Detection instead.

PhysX 4.1的更新删除了“启用统一高度图”选项。 最重要的是,我们还删除了Terrain组件属性中可用的厚度设置。 地形厚度旨在解决隧道效应,即快速移动的物体会在未检测到的情况下穿过地形表面。 现在厚度已经消失了,我们建议您 改为 使用 连续碰撞检测

运动学重新插入 (Kinematic re-insertion)

When a kinematic Rigidbody is turned into a non-kinematic one, the physics engine will now re-insert it into the broad-phase structures for the purposes of collision detection. This will cause an extra OnTriggerEnter event.

当运动学刚体变成非运动学刚体时,物理引擎现在将其重新插入到宽相结构中,以进行碰撞检测。 这将导致一个额外的OnTriggerEnter事件。

We’ve been focusing on polishing and stabilizing the PhysX integration in Unity, and we hope that this update will bring you improved precision, stability and performance. Get Unity 2019.3 beta to try it out and let us know what you think on the forum

我们一直专注于改进和稳定Unity中的PhysX集成,希望此更新将为您带来更高的精度,稳定性和性能。 获取 Unity 2019.3 beta 进行试用,并 在论坛上 告诉我们您的想法 !

翻译自: https://blogs.unity3d.com/2019/10/22/physics-updates-in-unity-2019-3/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值