Shader "Custom/Shader_VertexColor" {
Properties {
_MainTex ("Albedo", 2D) = "white" { }
_Color ("Color" , Color ) = (1, 1, 1, 1)
_MetallicGlossMap("Gloss Map", 2D) = "white" {} //追加
_Metallic ("Metallic" , Range(0, 1)) = 0.0
_Glossiness ("Smoothness", Range(0, 1)) = 0.5
_Occlusion ("Occlusion" , Range(0, 1)) = 1.0
_BumpScale ("Scale", Float) = 1
_BumpMap ("Normal Map", 2D) = "bump" { }
_DetailAlbedoMap("Detail Albedo x2", 2D) = "white" {}
_DetailNormalMapScale("Scale", Float) = 1.0
_DetailNormalMap("Normal Map", 2D) = "bump" {}
_DetailMask("Detail Mask", 2D) = "black" {}
}
SubShader {
Tags {
"Queue" = "Geometry"
"RenderType" = "Opaque"
}
CGPROGRAM
#pragma target 3.0
#pragma surface surf Standard fullforwardshadows
fixed4 _Color;
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _DetailAlbedoMap;
sampler2D _DetailNormalMap;
sampler2D _DetailMask;
sampler2D _MetallicGlossMap; //追加
half _BumpScale;
half _Glossiness;
half _Metallic;
half _Occlusion;
half _DetailNormalMapScale;
struct Input {
float2 uv_MainTex;
float2 uv2_DetailAlbedoMap;
fixed4 color : COLOR;
};
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c1 = tex2D(_MainTex, IN.uv_MainTex) * _Color;
fixed4 c2 = tex2D(_DetailAlbedoMap, IN.uv2_DetailAlbedoMap) * _Color;
fixed4 m = tex2D(_DetailMask, IN.uv_MainTex);
o.Albedo = lerp(c1, c2, m) * lerp(1, IN.color, _Occlusion);
half4 glossmap = tex2D(_MetallicGlossMap, IN.uv_MainTex); //追加
o.Metallic = glossmap.r * _Metallic; //修正
o.Smoothness = glossmap.a * _Glossiness; //修正
fixed3 n = UnpackScaleNormal(tex2D(_BumpMap, IN.uv_MainTex), _BumpScale);
fixed3 n2 = UnpackScaleNormal(tex2D(_DetailNormalMap, IN.uv2_DetailAlbedoMap), _DetailNormalMapScale);
o.Normal= BlendNormals(n, n2);
}
ENDCG
}
FallBack "Diffuse"
}
this.frame = this.ab.LoadAsset("frame.prefab") as GameObject;
this.frame = UnityEngine.Object.Instantiate<GameObject>(this.frame);
UnityEngine.Object.Destroy(this.frame);
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshFilter>().sharedMesh = this.frame.GetComponentInChildren<MeshFilter>().sharedMesh;
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshRenderer>().sharedMaterials = this.frame.GetComponent<MeshRenderer>().sharedMaterials;
this.ext = this.ab.LoadAsset("ext.prefab") as GameObject;
this.ext = UnityEngine.Object.Instantiate<GameObject>(this.ext);
this.ext.transform.SetParent(GameObject.Find("JONNEZ ES(Clone)/MESH/frame").transform);
this.ext.transform.localPosition = new Vector3(0f, 0f, 0f);
this.ext.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
this.ext.transform.localScale = new Vector3(1f, 1f, 1f);
this.col = this.ab.LoadAsset("col.fbx") as GameObject;
this.col = UnityEngine.Object.Instantiate<GameObject>(this.col);
UnityEngine.Object.Destroy(this.col);
GameObject.Find("JONNEZ ES(Clone)/Colliders/Coll").GetComponent<MeshCollider>().sharedMesh = this.col.GetComponentInChildren<MeshFilter>().mesh;
public override void OnLoad()
{
//タイヤの位置設定
GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelFL").transform.localPosition = new Vector3(-0.02f, 0f, 0.4698f);
GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelFR").transform.localPosition = new Vector3(0.02f, 0f, 0.4698f);
GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelRL").transform.localPosition = new Vector3(-0.02f, 0f, -0.47435f);
GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelRR").transform.localPosition = new Vector3(0.02f, 0f, -0.47435f);
}
public override void Update()
{
//タイヤのコリジョン設定
JONNEZ = GameObject.Find("JONNEZ ES(Clone)");
JONNEZ.GetComponent<Axles>().frontAxle.leftWheel.radius = 0.21f;
JONNEZ.GetComponent<Axles>().frontAxle.rightWheel.radius = 0.21f;
JONNEZ.GetComponent<Axles>().rearAxle.leftWheel.radius = 0.21f;
JONNEZ.GetComponent<Axles>().rearAxle.rightWheel.radius = 0.21f;
}