/// <summary> /// 操作主角对于其他人的碰撞层级 /// e.x. 设置层级Chara 为 false,则此角色对其他所有的Char层级的对象都会忽略碰撞,但是其他角色依然会对此角色产生碰撞 /// </summary> /// <param name="layer"></param> /// <param name="b"></param> public void SetCollision(LayerData layer, bool b) { var val = (1 << (int)layer); if (b) { Motor.CollidableLayers |= val; } else { if ((Motor.CollidableLayers & val) > 0) { Motor.CollidableLayers ^= val; } } }
public void SetLayer(LayerData layer, bool allChild = false) { SetLayer((int)layer, allChild); }
/// <summary> /// 获得Y轴坐标 /// </summary> /// <param name="trans"></param> /// <param name="yoffset"></param> /// <param name="layer"></param> /// <returns></returns> public static Vector3 GetRaycastY(Transform trans, float yoffset, LayerData layer) { return(GetRaycastY(trans, yoffset, (LayerMask)layer)); }
/// <summary> /// 检测Y轴碰撞体,防止下沉 /// </summary> /// <param name="trans"></param> /// <param name="yoffset"></param> /// <param name="mask"></param> public static void RaycastY(Transform trans, float yoffset, LayerData layer) { trans.position = GetRaycastY(trans, yoffset, layer); }