Unity3D,“被淘汰"输入轻型物体? [英] Unity3D, "knocked away" type light object?

查看:144
本文介绍了Unity3D,“被淘汰"输入轻型物体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Unity场景中,想象

In a Unity scene, imagine

  • 一个大的滑动物体(也许是出于某种原因而滑动的装运容器"或沙发")

  • a large sliding object (perhaps a "shipping container" or a "sofa" sliding along for some reason)

在地面上有一些2m高的轻木棍轻轻地粘在地面上.

in the way there are a number of 2m tall light wooden sticks lightly stuck in the ground.

在现实生活中,木棒会站在那里(首先,实际上在PhysX中很难做到这一点),当大物体撞击到木棒时,

in real life, the sticks would stand there (to begin with, this is annoyingly hard to achieve in PhysX actually), and when the large object hit them,

  • 大对象将完全不受影响

这些木棍会被轻快地敲掉,可能会反弹一两次,然后降落在某个地方

the sticks would be knocked away briskly, probably bounce off the ground once or twice and then land somewhere

我发现在Unity中很难做到这一点.

I have found this quite hard to do in Unity.

通常,您会说:给大物体质量几千,而棒状物的质量只有1或2公斤".

Normally you'd say: "give the large object a mass of a few thousand, and the sticks a mass of only 1 or 2 kg".

但是我发现那真的行不通-棍棒确实会绕着大型滑动物体旋转.

However I found that really doesn't work - the sticks DO tend to swirl the large sliding object around.

如果将大对象的角阻力设置为较高,则不是您想要的其他行为.

And if you set the angular drag of the large object high, that's not then what you want for it's other behaviors.

首先,我使木棍运动起来(这样它们就可以站起来而不会跌落),然后当大物体击打它时..

In the first instance I made the sticks kinematic (so they would stand up without falling over) and then when the large object whacks it ..

protected void OnCollisionEnter(Collision collisionInfo) {

    rb.isKinematic = false;
}

也许唯一的方法是

    实际上,
  • 的杆在物理上完全不受大物体的影响

  • in fact, have the sticks totally unaffected in physics by the large object

当他们触摸(触发)时,实际上只是独立地使摇杆随机飞起来". (让木棍仅与地面,风景碰撞.)

when they touch (trigger), in fact just independently have the stick randomly "fly off". (Have the sticks only collide with the ground, scenery.)

如何在Unity/PhysX环境中执行此操作?

How to do this in the Unity/PhysX milieu?

推荐答案

(将我的评论转换为答案)

(Converting my comment to an answer)

小物体会影响现实生活中的大物体,但是影响很小(所以可能有太多的木棍?).还是问题出在木棍插在地面上的方式?我用立方体(1000公斤)和一些圆柱体(1公斤)创建了测试场景.所有物体都自由地站立在地面上.这是当立方体撞到圆柱体时的样子:

Small objects will affect large object in real life, but just slightly (so maybe there are too many sticks?). Or maybe the problem is in the way sticks are stuck into the ground? I've created test scene with cube (1000 kg) and some cylinders (1 kg). All objects are just standing freely on the ground. Here what it looks like when the cube hits cylinders:

这篇关于Unity3D,“被淘汰"输入轻型物体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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