当我使用带有1个触发器的ontriggerenter时,一个固体对象进入(固体对象。沉入另一个固体对象。)另一个对象是刚体和碰撞对象
但是我需要使用oncolliderenter来立即获得点碰撞。不会像碰撞一样下沉。
我应该如何设置对象?哪个必须是刚体? (顺便说一句,我不想使用重力,我现在正在使用动画。当球击中飞机时,球必须在点碰撞时触发动画)
答案 0 :(得分:0)
摘自底部附近Colliders上的Unity3D的“手册”部分:
两个对象发生碰撞时,根据碰撞对象的刚体的配置,可能会发生许多不同的脚本事件。下表提供了基于连接到对象的组件调用哪些事件函数的详细信息。某些组合只会使两个对象之一受到碰撞的影响,但是一般规则是,物理不会应用于没有附加刚体组件的对象。
+======================================+=================+====================+==============================+=========================+============================+======================================+
| | Static Collider | Rigidbody Collider | Kinematic Rigidbody Collider | Static Trigger Collider | Rigidbody Trigger Collider | Kinematic Rigidbody Trigger Collider |
+======================================+=================+====================+==============================+=========================+============================+======================================+
| Static Collider | | Y | | | | |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Rigidbody Collider | Y | Y | Y | | | |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Kinematic Rigidbody Collider | | Y | | | | |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Static Trigger Collider | | | | | | |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Rigidbody Trigger Collider | | | | | | |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Kinematic Rigidbody Trigger Collider | | | | | | |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
+======================================+=================+====================+==============================+=========================+============================+======================================+
| | Static Collider | Rigidbody Collider | Kinematic Rigidbody Collider | Static Trigger Collider | Rigidbody Trigger Collider | Kinematic Rigidbody Trigger Collider |
+======================================+=================+====================+==============================+=========================+============================+======================================+
| Static Collider | | | | | Y | Y |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Rigidbody Collider | | | | Y | Y | Y |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Kinematic Rigidbody Collider | | | | Y | Y | Y |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Static Trigger Collider | | Y | Y | | Y | Y |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Rigidbody Trigger Collider | Y | Y | Y | Y | Y | Y |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+
| Kinematic Rigidbody Trigger Collider | Y | Y | Y | Y | Y | Y |
+--------------------------------------+-----------------+--------------------+------------------------------+-------------------------+----------------------------+--------------------------------------+