碰撞物体

发布于 2024-11-05 10:54:56 字数 470 浏览 1 评论 0原文

我正在通过 Unity 迈出第一步,作为此问题的后续步骤:

http://answers.unity3d.com/questions/56697/isometric-game-camera-limits

我现在意识到我不知道如何使对撞机真正发生碰撞。现在我有一个可以移动的游戏对象而不是相机,并且相机是该对象的子对象。它有一个盒子碰撞器,关卡周围还有其他四个盒子碰撞器,因此它会与它们碰撞……当然,它不起作用,因为我正在手动更改位置变量。我该怎么做才能发生冲突?使用刚体并对其施加力?有没有办法在上面设置 maxVelocity ?我看不到,除了刚体对于我想做的事情来说似乎有些过分了。否则我想我只是把质量设置为 1,并输出阻力和力,但我更愿意使用 maxSpeed,因为阻力也会影响加速度

I'm taking my first steps through Unity, as a follow up to this question:

http://answers.unity3d.com/questions/56697/isometric-game-camera-limits

I now realized that I don't know how to make a collider actually collide. Now I have a GameObject I move around instead of the camera, and the camera is a child to that object. It has a box collider, and there're four other box colliders around the level so it will collide against them.. and it's not working, of course, because I was changing the position variable by hand. What do I do so this collides? use a rigidBody and apply forces to it? is there a way to put a maxVelocity on it? I can't see one, besides a rigidbody seems sort of overkill for what I'm trying to do. Otherwise I guess I just put mass 1, and export drag and force, but I'd much rather work with a maxSpeed, because drag will also affect the acceleration rate

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泼猴你往哪里跑 2024-11-12 10:54:56

我不知道您是否错过了任何步骤,但如果有帮助的话,我可以告诉您我所做的事情。创建一个游戏对象。单击层次结构中的对象,然后转到顶部菜单和组件 -> 物理 -> 盒体碰撞器。添加盒体碰撞器后,您可能还需要调整碰撞器的大小。此外,请确保与您一起行走的角色也有碰撞器。

I don't know if you have missed any steps but I can tell you what I've done if it helps any. Create a game object. Click on the object in the hierarchy and go to the top menu and component->physics->box collider.After you add the box collider you may have to adjust the size of the colliders as well. In addition make sure you character you are walking around with also has a collider.

你是年少的欢喜 2024-11-12 10:54:56

您可以采用编程方法。我是否理解你的意思,你想用鼠标拖动凸轮或用按键移动它?您可以手动检查相机位置并以这种方式应用边界。如果你的相机被锁在一个盒子里,那么实现起来就很容易了。

You can take a programmatic approach. Do I get you right that you want to drag the cam around with the mouse or move it with keys? You can check the camera position by hand and apply boundings that way. It is quite easy to implement if your camera is locked into a single box.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文