【Unity探究】物理碰撞实验

197人阅读 评论(0)

----------------------------------------------------------------------------分割线--------------------------------------------------------------------------------

Static Collider 静态碰撞器

These are GameObjects that do not have a Rigidbody attached, but do have a Collider attached. These objects should remain still, or move very little. These work great for your environment geometry. They will not move if a Rigidbody collides with them.

Rigidbody Collider 刚体碰撞器

These GameObjects contain both a Rigidbody and a Collider. They are completely affected by the physics engine through scripted forces and collisions. They might collide with a GameObject that only contains a Collider. These will likely be your primary type of Collider in games that use physics.

Kinematic Rigidbody Collider 运动学刚体碰撞器

This GameObject contains a Collider and a Rigidbody which is marked IsKinematic. To move this GameObject, you modify its Transform Component, rather than applying forces. They're similar to Static Colliders but will work better when you want to move the Collider around frequently. There are some other specialized scenarios for using this GameObject.

Character Controllers 角色控制器

You use Character Controllers if you want to make a humanoid character. This could be the main character in a third person platformer, FPS shooter or any enemy characters.

These Controllers don't follow the rules of physics since it will not feel right (in Doom you run 90 miles per hour, come to halt in one frame and turn on a dime). Instead, a Character Controller performs collision detection to make sure your characters can slide along walls, walk up and down stairs, etc.

Character Controllers are not affected by forces but they can push Rigidbodies by applying forces to them from a script. Usually, all humanoid characters are implemented using Character Controllers.

Character Controllers are inherently unphysical, thus if you want to apply real physics - Swing on ropes, get pushed by big rocks - to your character you have to use a Rigidbody, this will let you use joints and forces on your character. Character Controllers are always aligned along the Y axis, so you also need to use a Rigidbody if your character needs to be able to change orientation in space (for example under a changing gravity). However, be aware that tuning a Rigidbody to feel right for a character is hard due to the unphysical way in which game characters are expected to behave. Another difference is that Character Controllers can slide smoothly over steps of a specified height, while Rigidbodies will not.

The Controller does not react to forces on its own and it does not automatically push Rigidbodies away.

If you want to push Rigidbodies or objects with the Character Controller, you can apply forces to any object that it collides with via the OnControllerColliderHit() function through scripting.

On the other hand, if you want your player character to be affected by physics then you might be better off using a Rigidbody instead of the Character Controller.

移动的静态碰撞器VS静止的刚体碰撞器

• 刚体的属性发生了变化；
• 和它通过关节连接的刚体发生了移动，因为连带关系，所以它也被唤醒了；
• 被其他刚体碰撞器碰撞。但是，只有处于运动状态中的刚体（包括普通的刚体碰撞器和运动学刚体碰撞器）能唤醒休眠中的刚体，静态碰撞器不能唤醒休眠中的刚体。即如果你将一个静态碰撞器(没有和任何刚体绑定过)绑定到处于休眠中的刚体，或者将静态碰撞器抽离处于休眠中的刚体时，这个休眠中的刚体是不会被唤醒的。但是如果你将一个运动中的刚体从它所属的且处于休眠状态中的顶层刚体移出时，处于休眠中的刚体将会被唤醒，且会在图形更新里被重新正确的计算。

移动的刚体碰撞器VS静止的刚体碰撞器

======================================================

移动的运动学刚体碰撞器VS静止的静态碰撞器

=======================================================

****************************************************************************************开始

移动的运动学刚体碰撞器VS静止的运动学刚体碰撞器

***************************************************************************************  结束

碰撞信息和触发信息

 Collision detection occurs and messages are sent upon collision 碰撞后有碰撞检测并有碰撞信息发出 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 运动学刚体触发碰撞器
 Trigger messages are sent upon collision 碰撞后有触发信息 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

0
0

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：61043次
• 积分：2813
• 等级：
• 排名：第12700名
• 原创：196篇
• 转载：228篇
• 译文：1篇
• 评论：10条
坐标
天马脚下，岳麓山前
文章分类
最新评论