Continuous collision detection (CCD) 连续式碰撞检测
本文档主要是对Unity官方手册的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于Unity2018.4版本
参考链接:https://docs.unity3d.com/Manual/ContinuousCollisionDetection.html
CCD ensures that fast-moving bodies collide with objects instead of passing, or tunnelling, through those objects. Unity provides the following CCD methods:
CCD确保快速移动的物体与物体发生碰撞,而不是穿过这些物体,或穿入物体。Unity提供了以下CCD方法:
- Sweep-based CCD
- Speculative CCD
To use sweep-based CCD, select a RigidBody in the Inspector window and set Collision Detection to Continuous or Continuous Dynamic. For speculative CCD, set Collision Detection to Continuous Speculative.
要使用基于扫描式的CCD,请在Inspector 窗口中选择刚体,并将碰撞检测设置为连续或连续动态。对于推测式的CCD,将碰撞检测设置为连续推测。
Sweep-based CCD
Sweep-based CCD uses a Time Of Impact (TOI) algorithm to compute potential collisions for an object by sweeping its forward trajectory using its current velocity. If there are contacts along the object’s moving direction, the algorithm computes the time of impact and moves the object until that time. The algorithm can perform sub steps from that time onwards, computing the velocity after TOI then re-sweep, at the expense of more CPU cycles.
基于扫描式的CCD用撞击时间(TOI)算法,把物体当前的速度扫描其前进