c# - unity2d 创建一个单侧对撞机

标签 c# unity3d

我有一个冒险岛游戏演示

我需要角色可以从一侧跳过碰撞器

我的角色和地面中的对撞机是这样的:

字符:capsulecollider2d

ground:polygoncollider2d

enter image description here

所以角色可以站在地上

enter image description here enter image description here

还可以在地上跳

但是现在我想让角色从地底跳下去,不行

enter image description here

那么,我该如何处理这个问题呢?有没有一种配置可以让对撞机只有一侧?

------------------------------------2017年08月11日------ ------------------------------

非常感谢大家

谢谢@EmreE @Jeroen De Clercq

我使用@EmreE 提供的 Platform Effector 2D 解决了这个问题

enter image description here

首先:在我的地面上添加平台效应器 2d 并选择“使用一种方式”

第二个:选择“Used by Effector”

enter image description here

现在可以了:)

enter image description here

最佳答案

  • 把你的地板放在一层;
  • 将您的平台放在一个层中;
  • 当你跳跃时,消除与平台层的碰撞,直到你到达指向地板的方向。
  • 当您按下键时,消除与平台的碰撞,直到您通过一个平台层。

这里有更多信息; https://docs.unity3d.com/ScriptReference/Physics.IgnoreLayerCollision.html

关于c# - unity2d 创建一个单侧对撞机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45619107/

相关文章:

c# - 使用NCrunch,FxCop分析仪和 “warnings as errors” : How to configure warning severity in NCrunch?

c# - 在 UWP Windows 10 C# 中创建带边框的圆形按钮

c# - Unity table 游AI导致内存泄露

c# - 在 .NET 3.5 下的 Unity3D 中使用 Simple Injector 1 进行属性注入(inject)

iOS 8 : Game Stuck on Loading Screen

c# - UNET - 让任何玩家向同一个 NetworkIdentity 发送命令

c# - .Net GetProcesses 的访问被拒绝

c# - 在浏览器控件中以编程方式填写 PDF 表单字段

c# - 防止 Windows 服务管理器停止服务 c#

c# - 如何使用 StartCoroutine 在 7 秒内将变量值从 300 递增到 0 递增 1?