简体   繁体   English

在Unity中微动一个游戏对象

[英]Jiggling a gameobject in Unity

How do I make a gameobject like a sphere to jiggle in space, meaning rapidly moving around in random directions while holding it's original position. 如何使像球形的游戏对象在空间中摇动,这意味着在保持其原始位置的同时在随机方向上快速移动。

I know I can come up with some really long codes to kind of simulate this but I was wondering if there is a trick to it. 我知道我可以提出一些很长的代码来模拟这种情况,但是我想知道是否有窍门。

Thanks 谢谢

I think what you want are joints. 我认为您想要的是关节。 You can attach a spring joint component to a gameObject with a rigidbody. 您可以使用刚体将弹簧关节组件附加到gameObject。 On the spring joint, set the connected body to a seperate gameObject with a kinematic rigidbody, then play with the spring joint settings until you get a nice jiggle effect. 在弹簧关节上,将连接的物体设置为带有运动刚体的单独游戏对象,然后使用弹簧关节设置进行操作,直到获得不错的微动效果。 Probably increase the Spring value a bunch. 大概增加一堆Spring值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM