Speculative collisionA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
当物理引擎检测到两个游戏对象的碰撞器发生接触或重叠,并且至少一个游戏对象具有刚体组件并且处于运动状态时,就会发生碰撞。更多信息
See in Glossary 参见术语表 detection is the CCD algorithm for Continuous Speculative mode.
Speculative collision detectionAn automatic process performed by Unity which determines whether a moving GameObject with a Rigidbody and collider component has come into contact with any other colliders. More info
Unity 执行的自动过程,用于确定具有刚体和碰撞器组件的移动游戏对象是否与任何其他碰撞器发生接触。更多信息
See in Glossary 参见术语表 is less computationally demanding than sweep-based collision detection. It also works for collisions that occur as a result of both linear movement (for example, a ball moving in a straight line) and rotational movement (for example, a pinball flipper colliding with a ball when it rotates on its pivot).
However, Continuous Speculative can also be less accurate; as well as missed collisions, “false collisions” can occur, where the algorithm incorrectly predicts a collision and forces the collidersAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
用于处理对象的物理碰撞的不可见形状。对撞机的形状不需要与对象的网格完全相同 - 粗略的近似通常在游戏玩法中更有效且难以区分。更多信息
See in Glossary 参见术语表 off-course.
Speculative CCD works by increasing an object’s broad-phase axis-aligned minimum bounding box (AABB), based on the object’s linear and angular motion. The algorithm is speculative because it selects all potential contacts during the next physics step and feeds them into the solver, which makes sure that all contact constraints are satisfied so that a RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
允许游戏对象受到模拟重力和其他力影响的组件。更多信息
See in Glossary 参见术语表 does not tunnel through any collision.
An inflated AABB based on the current velocity helps detect all potential contacts along the moving trajectory, which enables the solver to prevent missed collisions (“tunneling”).
Speculative CCD is generally less resource-intensive than sweep-based CCD, because it only computes during the collision detection phase, not during the solving and integrating phase. Additionally, speculative CCD can find contacts that sweep-based CCD might miss, because speculative CCD expands the broad-phase AABB based on both the object’s linear and angular motion.
However, speculative CCD can cause a false collision (or “ghost collision”), where an object’s motion is affected by a speculative contact point when it shouldn’t be. This is because speculative CCD collects all potential contacts based on the closest point algorithm, so the contact normal is less accurate. This can often make high-speed objects slide along tessellated collision features and jump up, even though they shouldn’t. For example, in the following diagram, a sphere starts at t0 and moves horizontally towards the right, with a predicted position at t1 after integration. An inflated AABB overlaps the boxes b0 and b1, and the CCD yields two speculative contacts at c0 and c1. Because speculative CCD generates contacts using the closest point algorithm, c0 has a very inclined normal, which the solver assumes to be a ramp.
Such an inclined normal causes t1 to jump upward after integration, rather than moving straight forward:
Speculative CCD can also cause missed collisions because speculative contacts are only computed during the collision detection phase. During contact solving, if an object gains too much energy from the solver, it might end up outside the initial inflated AABB after integration. If there are collisions just outside the AABB, the object tunnels right through.
For example, in the following diagram, a sphere is moving left from t0 while a stick rotates clockwise. If the sphere gains too much energy from the impact, it might end up exiting the inflated AABB (red dotted rectangle) at t1. If there are collisions just outside the AABB, as shown by the blue box below, the sphere may end up missing the collision and tunneling right through it. This is because the solver only computes contacts inside the inflated AABB, and collision detection isn’t performed during the solving and integrating phase.
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.