简体   繁体   English

如何检查多个对象碰撞

[英]How to Check Multiple Object Collisions

So I want to have air time in my game, but I can't figure out how to check the collisions of all my wheels.所以我想在我的游戏中有播放时间,但我不知道如何检查我所有车轮的碰撞。 I can only check whether a single wheel is colliding with the floor, not if all of my wheels are colliding with the floor.我只能检查单个车轮是否与地板发生碰撞,而不能检查所有车轮是否都与地板发生碰撞。

Sorry for the poor wording, but the goal is to check to see if any of the four wheels are touching the floor.抱歉措辞不好,但目标是检查四个轮子中的任何一个是否接触地板。

There are several ways to achieve this, but one would be to create multiple Colliders for each wheel.有几种方法可以实现这一点,但一种方法是为每个轮子创建多个碰撞器。 Then you check whether each of these wheels is currently touching the ground.然后检查这些轮子中的每一个当前是否都接触地面。 So you would have an extra Collider Object per wheel to check this.所以你每个轮子都会有一个额外的碰撞器对象来检查这个。

Another way would be that if you have like one Object as car you could check the positions your object is having collisions with and calculate them but that would be way to complicated because I dont think performance will be that important for you.另一种方法是,如果您将一个对象作为汽车,您可以检查您的对象与之发生碰撞的位置并计算它们,但这会很复杂,因为我认为性能对您来说并不那么重要。

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

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