物理对象在Unity中无法以低速正确反弹 [英] Physics object doesn't bounce correctly at low speed in Unity

查看:303
本文介绍了物理对象在Unity中无法以低速正确反弹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,当启用物理的球缓慢移动时,它无法正确地弹开物体.我拍了一段视频来说明问题

https://youtu.be/9T1hkir7sCo

基本上,球应该碰到静止的球,静止的球应该弹起.当速度足够快但在阈值以下时,它们都开始一起移动,这看起来很奇怪,这可以起作用.

这是怎么回事,如何使它正确反应?

实验细节(两个对象都相同):

RigidBody

  • 质量:1
  • 拖动:0
  • 角向阻力:0
  • 使用重力:false

物理材料:

  • 动摩擦:0
  • 静摩擦:0
  • 弹跳:1

解决方案

Unity的默认设置 Bounce Threshold 用于识别跳动的是速度> 2

设置速度值.如果两个碰撞对象的相对速度低于此值,则它们不会相互反弹.此值还可以减少抖动,因此不建议将其设置为非常低的值.


您可以在PhysicsManager(编辑-> 项目设置-> 物理)中更改此Bounce Threshold:

或在运行时通过脚本(请参见 Physics.bounceThreshold )

Physics.bounceThreshold = 1;


根据需要将其缩小...但是请注意

此值还可以减少抖动,因此不建议将其设置为非常低的值.

I am running into a problem where when a physics enabled ball is going slowly it doesn't bounce off objects correctly. I have made a video to illustrate the problem

https://youtu.be/9T1hkir7sCo

Basically, the ball should run into the stationary ball and the stationary one should bounce off. This works when the speed is fast enough, but below a threshold they both just start moving together, which looks weird.

Whats going with this, and how can I make it react properly?

Experiment details (same for both objects):

RigidBody

  • Mass: 1
  • Drag: 0
  • Angular Drag: 0
  • Use gravity: false

Physics material:

  • Dynamic friction: 0
  • Static friction: 0
  • Bounciness: 1

解决方案

Unity's default Bounce Threshold for recognizing bounces is a velocity > 2

Set a velocity value. If two colliding objects have a relative velocity below this value, they do not bounce off each other. This value also reduces jitter, so it is not recommended to set it to a very low value.


You can change this Bounce Threshold in the PhysicsManager (Edit->Project Settings->Physics):

or via script on runtime (see Physics.bounceThreshold)

Physics.bounceThreshold = 1;


Make it as small as you need it ... but note

This value also reduces jitter, so it is not recommended to set it to a very low value.

这篇关于物理对象在Unity中无法以低速正确反弹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆