一组选项,用于控制在使用作业系统进行多线程物理模拟时物理系统的工作方式。
目前,多线程物理还是一项实验性功能。因此,公开了许多选项,让您能够进行在功能正式发布后可能无法实现的性能配置。
物理模拟在以下独立阶段中执行:
• 查找新接触点\
• 接触碰撞\
• 离散解算器(清除孤岛标志 > 离散孤岛遍历 > 离散孤岛解算器 > 同步夹具 > 查找新接触点)\
• 连续解算器(清除孤岛标志 > 连续孤岛遍历 > 离散孤岛解算器 > 同步夹具 > 查找新接触点)\
• 清除身体力\
• 更新触发器接触点
这些阶段按上面给出的顺序执行。每个阶段都作为一个作业“任务”运行。每个任务执行一些子作业任务(上面括号中显示的内容)。执行作业时,物理模拟可以跨多个作业线程处理身体、接触点、关节等。您可以为每个线程分配任务,让其执行特定数量的项目,例如身体、接触点和关节。此处提供的许多选项让您能够控制分配给每个作业的最小项目数。增加最小项目数可能会减少所需的作业数。这是因为运行大量作业(每个作业仅处理少许项目)的效率通常不高。默认设置为作业平衡提供了不错的性能,但您也可以随意尝试其他设置。
此外,在运行模拟前,还将存储 Rigidbody2D 插值/外推姿势,以做好进行每帧插值/外推的准备。它们也使用作业系统执行,并在此处进行控制。
clearBodyForcesPerJob | 控制在每个模拟作业中要清除的最小实体数。 |
clearFlagsPerJob | 控制在每个模拟作业中要清除的最小标志数。 |
collideContactsPerJob | 控制在每个模拟作业中要碰撞的最小接触数。 |
findNearestContactsPerJob | 控制在每个模拟作业中要查找的最小最近接触数。 |
interpolationPosesPerJob | 控制在每个模拟作业中进行插值的最小 Rigidbody2D 数。 |
islandSolverBodiesPerJob | 执行孤岛解算时,控制在每个模拟作业中要解算的最小实体数。 |
islandSolverBodyCostScale | 在离散孤岛解算过程中缩放每个身体的成本。 |
islandSolverContactCostScale | 在离散孤岛解算过程中缩放每个接触的成本。 |
islandSolverContactsPerJob | 执行孤岛解算时,控制在每个模拟作业中要解算的最小接触数。 |
islandSolverCostThreshold | 离散孤岛解算过程中,某个孤岛中所有身体、接触和关节的最小阈值成本。 |
islandSolverJointCostScale | 在离散孤岛解算过程中缩放每个关节的成本。 |
newContactsPerJob | 控制在每个模拟作业中要查找的最小新接触数。 |
syncContinuousFixturesPerJob | 控制在每个模拟作业的连续孤岛解算过程中,要在粗筛阶段中同步的最小夹具数。 |
syncDiscreteFixturesPerJob | 控制在每个模拟作业的离散孤岛解算过程中,要在粗筛阶段中同步的最小夹具数。 |
updateTriggerContactsPerJob | 控制在每个模拟作业中要更新的最小触发器接触数。 |
useConsistencySorting | 物理模拟是否应对多线程结果进行排序以保持处理顺序一致性? |
useMultithreading | 物理模拟是否应使用多线程? |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.