小编Mer*_*lin的帖子

在Unity3D中,我正在关注一个tilemap教程.但是,UV布局很奇怪.我怎样才能解决这个问题?

我正在按照以下教程设置:https://www.youtube.com/watch?v = owBt9SNKXCI&index = 6&list = PLbghT7MmckI4qGA0Wm_TZS8LVrqS47I9R来动态构建切片贴图布局.它适用于某一点,但它产生了一个非常奇怪的布局,128 x 128大小的瓷砖.

在此输入图像描述

很明显,不应该发生奇怪的分区,但我似乎无法追查导致它的原因.这是我的代码版本,它与quill18creates的版本大致相同,只有一些小差异:

using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
public class TileMap : MonoBehaviour {

    public int size_x = 100;
    public int size_z = 50;
    public float tileSize = 1.0f;

    public Texture2D terrainTiles;
    int tileResolution = 128;

    // Use this for initialization
    void Start () {
        BuildMesh();
    }

    Color[][] ChopUpTiles() {
        int numTilesPerRow = terrainTiles.width / tileResolution;
        int numRows = terrainTiles.height / tileResolution;

        Color[][] tiles = new Color[numTilesPerRow*numRows][];

        for(int y=0; …
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine uv-mapping

9
推荐指数
1
解决办法
1268
查看次数

如何正确配置 nginx 以与 NG Serve 和 Angular CLI 一起使用?

我一直在尝试研究 Nginx 以在 localhost:4200 上配置具有 Angular 5 ng 服务的代理,但是只得出为已构建的项目提供服务的结果。我从这项研究中发现的配置“有点”有效,但会产生一个未加载任何数据的白页:

dev:12 GET http://192.168.1.84/inline.bundle.js net::ERR_ABORTED
dev:12 GET http://192.168.1.84/polyfills.bundle.js net::ERR_ABORTED
dev:12 GET http://192.168.1.84/styles.bundle.js net::ERR_ABORTED
dev:12 GET http://192.168.1.84/vendor.bundle.js net::ERR_ABORTED
dev:12 GET http://192.168.1.84/main.bundle.js net::ERR_ABORTED
Run Code Online (Sandbox Code Playgroud)

看起来它看不到 ng serve 提供的文件,但至少到达了项目的 index.html 页面。这是我目前使用的配置:

location /dev {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        rewrite ^/(.*)$ /$1 break;
        proxy_set_header Host localhost;
        proxy_pass http://localhost:4200;
}
Run Code Online (Sandbox Code Playgroud)

我应该在 /dev 配置中添加什么?

nginx angular

7
推荐指数
1
解决办法
5730
查看次数

Mongoose 导致 100 多个类型错误破坏了构建?

我正在尝试为小型 API 运行服务器构建。然而,我遇到了一个痛苦的问题。Mongoose 无法在 TypeScript 下编译,因为它是 MongoDB 的内部构建。这个问题是类似的,但不是其他问题的精确重复 - 我找到了其中的一些,但他们的解决方案不起作用。

这是我得到的输出,有错误:

> servapi@1.0.0 clean
> node node_modules/rimraf/bin lib

node_modules/mongodb/mongodb.d.ts:3571:117 - error TS1005: '?' expected.

3571 export declare type Join<T extends unknown[], D extends string> = T extends [] ? '' : T extends [string | number] ? `${T[0]}` : T extends [string | number, ...infer R] ? `${T[0]}${D}${Join<R, D>}` : string;
                                                                                                                        

node_modules/mongodb/mongodb.d.ts:3571:127 - error TS1005: ';' expected.

3571 export declare type Join<T extends unknown[], D extends string> = T extends …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb node.js typescript typescript-typings

6
推荐指数
1
解决办法
1790
查看次数

有没有办法避免使用画布缩放信箱?

我正在使用Pixi.js作为渲染引擎,在Javascript中开展一个小项目.但是,我只发现了一些将画布缩放到完整窗口的方法,这些方法似乎最适合当前版本.但是,它有一个警告,因为它根据方向在侧面产生信箱.

是否可以通过Pixi避免使用信箱?

在此输入图像描述

这是我到目前为止的代码,因为它与缩放有关:

var application = null;
var GAME_WIDTH = 1060;
var GAME_HEIGHT = 840;
var ratio = 0;
var stage = null;
application = new PIXI.Application(
{
    width: GAME_WIDTH,
    height: GAME_HEIGHT,
    backgroundColor: 0x00b4f7,
    view: document.getElementById("gwin")
});

stage = new PIXI.Container(true);

window.addEventListener("resize", rescaleClient);

function rescaleClient()
{
    ratio = Math.min(window.innerWidth / GAME_WIDTH, window.innerHeight / 
    GAME_HEIGHT);
    stage.scale.x = stage.scale.y = ratio;
    application.renderer.resize(Math.ceil(GAME_WIDTH * ratio), Math.ceil(GAME_HEIGHT * ratio));     
}
Run Code Online (Sandbox Code Playgroud)

我的目标是实现与Agar.io/Slither.io类似的全屏/窗口效果,但是我还没有找到一种方便的方法.似乎有一些使用Pixi来实现这一目标的例子,但代码通常是封闭源代码,并且它们似乎使用外部工具,如Ionic和Phonegap.

javascript canvas pixi.js

5
推荐指数
1
解决办法
212
查看次数

我正在尝试修改 Unity 中的着色器,但收到“‘自定义/子空间外观’中的着色器错误:第 82 行(在 d3d11 上)无法识别的标识符‘输入’”?

我想立即声明我不经常使用着色器,而我正在使用的基本着色器 - 来自 Unity 论坛中的一个线程的力场着色器,是一个更旧的版本。然而,原来的“几乎”做了我想要的。

我想修改它以添加滚动效果以模拟速度,但奇怪的是我得到了“无法识别的标识符‘输入’”。IN Input 是一个普通变量.. 据说,在 Unity 的着色器中。到目前为止,这是我的代码:

Shader "Custom/SubspaceLook" {

Properties {
   _Color ("Main Color", Color) = (1,1,1,0.5)
   _MainTex ("Texture", 2D) = "white" {}
   _UVScale ("UV Scale", Range (0.05, 4)) = 1
   _UVDistortion ("UV Distortion", Range (0.01, 1)) = 0.5
   _Rate ("Oscillation Rate", Range (5, 200)) = 10
   _Rate2 ("Oscillation Rate Difference", Range (1, 3)) = 1.43
   _ZPhase ("Z Phase", Range (0, 3)) = 0.5
   _Scale ("Scale", Range (0.02, 2)) = 0.5
   _Distortion ("Distortion", Range (0, …
Run Code Online (Sandbox Code Playgroud)

shader unity-game-engine

-1
推荐指数
1
解决办法
4249
查看次数