rigidbody中Is Kinematic 和collider中的Is Trigger

官方文档对于Is Kinematic的解释是这样的:Movement in Unity that is not physics-based is called kinematic motion,when enabled, defines the attached GameObject as non-physics-based, and removes it from the control of the physics engine.

也就是说,勾选了Is Kinematic ,对象就不会受到物理系统给到的作用力,如重力、相撞时的反弹力等等 但我们可以通过代码控制它的Transform来改变GameObject的位移和旋转

文档还有如下描述:

A kinematic Rigidbody can apply physics-based force to physics-based Rigidbody GameObjects, but does not receive physics-based force. For example, a kinematic Rigidbody can collide with and “push” a Rigidbody that has physics-based movement, but a Rigidbody with physics-based movement cannot “push” a kinematic Rigidbody.

也就是说勾选了Is Kinematic的GameObject不能够被没有勾选的物体推动或产生碰撞力

也就是说我们可以给一个墙勾选上,玩家不勾选,当玩家去撞这堵墙的时候,墙的质量再小也不会被玩家所推动

If you use a Joint to attach a kinematic Rigidbody to a non-kinematic Rigidbody, the Joint cannot exert forces to move the kinematic Rigidbody. It can only ever move the non-kinematic Rigidbody. However, you can still move the kinematic Rigidbody via the Transform, and the Joint can adjust the pose of the non-kinematic body to satisfy the joint limits.

  • 当一个动力学物体(勾选了Is Kinematic)通过Joint与一个非动力学物体(没有勾选Is Kinematic)连接时,Joint不能对动力学物体施加力来移动它。这是因为动力学物体不响应物理力,它的移动完全是通过编程控制的。
  • 然而,Joint仍然可以调整非动力学物体的位置和姿态,以满足Joint的限制(比如保持两个物体之间的距离或角度),即使它连接的是一个动力学物体。
  • 这意味着,我们可以通过编程改变动力学物体的Transform来移动它,而Joint会相应地调整非动力学物体的姿态,以保持连接的约束条件。

最需要明确的是Is Trigger 勾选后,仍然会受到重力的作用,相当于是变成了一个触发特定事件的区域,使得他不再参与碰撞的处理(比如阻挡或者是推动物体)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值