Shader "Custom/Billboard"
{
Properties
{
_MainTex("Texture Image", 2D) = "white" {}
_ScaleX("Scale X", Float) = 1.0
_ScaleY("Scale Y", Float) = 1.0
}
SubShader
{
Tags {"Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent"}
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// User-specified uniforms
uniform sampler2D _MainTex;
uniform float _ScaleX;
uniform float _ScaleY;
struct vertexInput
{
float4 vertex : POSITION;
float4 tex : TEXCOORD0;
};
struct vertexOutput
{
float4 pos : SV_POSITION;
float4 tex : TEXCOORD0;
};
vertexOutput vert(vertexInput input)
{
vertexOutput output;
output.pos = mul(UNITY_MATRIX_P,
mul(UNITY_MATRIX_MV, float4(0.0, 0.0, 0.0, 1.0))
+ float4(input.vertex.x, input.vertex.y, 0.0, 0.0)
* float4(_ScaleX, _ScaleY, 1.0, 1.0));
output.tex = input.tex;
return output;
}
float4 frag(vertexOutput input) : COLOR
{
return tex2D(_MainTex, float2(input.tex.xy));
}
ENDCG
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BillBoard : MonoBehaviour
{
private SpriteRenderer theSR;
// Start is called before the first frame update
void Start()
{
theSR = GetComponent<SpriteRenderer>();
theSR.flipX = true;
}
// Update is called once per frame
void Update()
{
transform.LookAt(PlayerController.instance.transform.position, -Vector3.forward);
}
}
public static PlayerController instance;
private void Awake()
{
instance = this;
}
Цитата: Bhudh от октября 20, 2019, 12:57Сам в шоке.Цитата: Easyskanker от октября 20, 2019, 01:30Вот за такое использование кванторов надо бить. Чётко и больно. Если написано "ВСЕ", должны быть ВСЕ, безо всяких advanced.
Отобразятся все пакеты. Все, да не все.
Что это за "всё и ещё чуть-чуть"?
Страница создана за 0.076 сек. Запросов: 25.