简体   繁体   English

如何在 Unity 中制作“移动”边界?

[英]How can I make a “mobile” boundary in Unity?

I've been working on an Undertale fangame and I'm facing a problem.我一直在制作 Undertale fangame,但我遇到了一个问题。 In the fight box, the Player's soul (aka character) can pass the Edge Collider and go through the edge.在战斗箱中,玩家的灵魂(又名角色)可以通过边缘对撞机和 go。 I was thinking about using a Boundary instead, but I want to make the fight box move during the attacks, so I need to move the boundaries with the box.我正在考虑使用边界来代替,但我想让战斗箱在攻击过程中移动,所以我需要用盒子移动边界。 How can I do that?我怎样才能做到这一点? 在此处输入图像描述

It should work with an edge collider.它应该与边缘对撞机一起使用。 It's important that you use the EdgeCollider 2D , because it is a 2D game.使用 EdgeCollider 2D很重要,因为它是一款 2D 游戏。 Does your player have some sort of Collider 2d as well and is the "Is Trigger" option set to false on both colliders?您的播放器是否也有某种 Collider 2d ,并且两个对撞机上的“Is Trigger”选项是否都设置为 false? If you then want to move the EdgeCollider2D, you can just move the GameObject.如果你想移动 EdgeCollider2D,你可以移动 GameObject。

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

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