ADD : 스트리밍글 초기 설정파일 업데이트

This commit is contained in:
KINDNICK 2025-04-25 21:09:24 +09:00
parent 78a7fb28ac
commit ed72287a5c
5273 changed files with 2876191 additions and 0 deletions

BIN
.vscode/extensions.json (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
.vscode/launch.json (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
.vscode/settings.json (Stored with Git LFS) vendored Normal file

Binary file not shown.

8
Assets/External.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f243f02b195efc94faecee0ee5d0fa4b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/External/Ifacialmocap.meta vendored Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 223415c286f7fd74f85d05754d2da6ad
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,386 @@
using UnityEngine;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Collections.Generic;
using System;
using System.Collections;
using System.Globalization;
public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
{
// broadcast address
public bool gameStartWithConnect = true;
public string iOS_IPAddress = "255.255.255.255";
private UdpClient client;
private bool StartFlag = true;
//object names
public string faceObjectGroupName = "";
public string headBoneName = "";
public string rightEyeBoneName = "";
public string leftEyeBoneName = "";
public string headPositionObjectName = "";
private UdpClient udp;
private Thread thread;
private SkinnedMeshRenderer meshTarget;
private List<SkinnedMeshRenderer> meshTargetList;
private List<GameObject> headObjectArray;
private List<GameObject> rightEyeObjectArray;
private List<GameObject> leftEyeObjectArray;
private List<GameObject> headPositionObjectArray;
private string messageString = "";
public int LOCAL_PORT = 49983;
// Start is called
void StartFunction()
{
if (StartFlag == true)
{
StartFlag = false;
FindGameObjectsInsideUnitySettings();
//Send to iOS
if (gameStartWithConnect == true)
{
Connect_to_iOS_App();
}
//Recieve udp from iOS
CreateUdpServer();
}
}
void Start()
{
StartFunction();
}
void CreateUdpServer()
{
udp = new UdpClient(LOCAL_PORT);
udp.Client.ReceiveTimeout = 5;
thread = new Thread(new ThreadStart(ThreadMethod));
thread.Start();
}
IEnumerator WaitProcess(float WaitTime)
{
yield return new WaitForSeconds(WaitTime);
}
void Connect_to_iOS_App()
{
//iFacialMocap
SendMessage_to_iOSapp("iFacialMocap_sahuasouryya9218sauhuiayeta91555dy3719", 49983);
//Facemotion3d
SendMessage_to_iOSapp("FACEMOTION3D_OtherStreaming", 49993);
}
void StopStreaming_iOS_App()
{
SendMessage_to_iOSapp("StopStreaming_FACEMOTION3D", 49993);
}
//iOSアプリに通信開始のメッセージを送信
//Send a message to the iOS application to start streaming
void SendMessage_to_iOSapp(string sendMessage,int send_port)
{
try
{
client = new UdpClient();
client.Connect(iOS_IPAddress, send_port);
byte[] dgram = Encoding.UTF8.GetBytes(sendMessage);
client.Send(dgram, dgram.Length);
client.Send(dgram, dgram.Length);
client.Send(dgram, dgram.Length);
client.Send(dgram, dgram.Length);
client.Send(dgram, dgram.Length);
}
catch { }
}
// Update is called once per frame
void Update()
{
try
{
SetAnimation_inside_Unity_settings();
}
catch
{ }
}
//BlendShapeの設定
//set blendshapes
void SetBlendShapeWeightFromStrArray(string[] strArray2)
{
string mappedShapeName = strArray2[0].Replace("_R", "Right").Replace("_L", "Left");
float weight = float.Parse(strArray2[1], CultureInfo.InvariantCulture);
foreach (SkinnedMeshRenderer meshTarget in meshTargetList)
{
var shared_mesh = meshTarget.sharedMesh;
int index = shared_mesh.GetBlendShapeIndex(mappedShapeName);
if (index > -1)
{
meshTarget.SetBlendShapeWeight(index, weight);
}
}
}
//BlendShapeとボーンの回転の設定
//set blendshapes & bone rotation
void SetAnimation_inside_Unity_settings()
{
try
{
string[] strArray1 = messageString.Split('=');
if (strArray1.Length >= 2)
{
//blendShapes
foreach (string message in strArray1[0].Split('|'))
{
string[] strArray2 = new string[3];
if (message.Contains("&"))
{
strArray2 = message.Split('&');
}
else
{
strArray2 = message.Split('-');
}
if (strArray2.Length == 2)
{
SetBlendShapeWeightFromStrArray(strArray2);
}
}
foreach (string message in strArray1[1].Split('|'))
{
string[] strArray2 = message.Split('#');
if (strArray2.Length == 2)
{
string[] commaList = strArray2[1].Split(',');
if (strArray2[0] == "head")
{
foreach (GameObject headObject in headObjectArray)
{
headObject.transform.localRotation = Quaternion.Euler(float.Parse(commaList[0], CultureInfo.InvariantCulture), -float.Parse(commaList[1], CultureInfo.InvariantCulture), -float.Parse(commaList[2], CultureInfo.InvariantCulture));
}
foreach (GameObject headPositionObject in headPositionObjectArray)
{
headPositionObject.transform.localPosition = new Vector3(-float.Parse(commaList[3], CultureInfo.InvariantCulture), float.Parse(commaList[4], CultureInfo.InvariantCulture), float.Parse(commaList[5], CultureInfo.InvariantCulture));
}
}
else if (strArray2[0] == "rightEye")
{
foreach (GameObject rightEyeObject in rightEyeObjectArray)
{
rightEyeObject.transform.localRotation = Quaternion.Euler(float.Parse(commaList[0], CultureInfo.InvariantCulture), -float.Parse(commaList[1], CultureInfo.InvariantCulture), float.Parse(commaList[2], CultureInfo.InvariantCulture));
}
}
else if (strArray2[0] == "leftEye")
{
foreach (GameObject leftEyeObject in leftEyeObjectArray)
{
leftEyeObject.transform.localRotation = Quaternion.Euler(float.Parse(commaList[0], CultureInfo.InvariantCulture), -float.Parse(commaList[1], CultureInfo.InvariantCulture), float.Parse(commaList[2], CultureInfo.InvariantCulture));
}
}
}
}
}
}
catch
{
}
}
void FindGameObjectsInsideUnitySettings()
{
//Find BlendShape Objects
meshTargetList = new List<SkinnedMeshRenderer>();
GameObject faceObjGrp = GameObject.Find(faceObjectGroupName);
if (faceObjGrp != null)
{
List<GameObject> list = FM3D_and_iFacialMocap_GetAllChildren.GetAll(faceObjGrp);
foreach (GameObject obj in list)
{
meshTarget = obj.GetComponent<SkinnedMeshRenderer>();
if (meshTarget != null)
{
if (HasBlendShapes(meshTarget) == true)
{
meshTargetList.Add(meshTarget);
}
}
}
}
//Find Bone Objects
headObjectArray = new List<GameObject>();
foreach (string headString in headBoneName.Split(','))
{
GameObject headObject = GameObject.Find(headString);
if (headObject != null)
{
headObjectArray.Add(headObject);
}
}
rightEyeObjectArray = new List<GameObject>();
foreach (string rightEyeString in rightEyeBoneName.Split(','))
{
GameObject rightEyeObject = GameObject.Find(rightEyeString);
if (rightEyeObject != null)
{
rightEyeObjectArray.Add(rightEyeObject);
}
}
leftEyeObjectArray = new List<GameObject>();
foreach (string leftEyeString in leftEyeBoneName.Split(','))
{
GameObject leftEyeObject = GameObject.Find(leftEyeString);
if (leftEyeObject != null)
{
leftEyeObjectArray.Add(leftEyeObject);
}
}
headPositionObjectArray = new List<GameObject>();
foreach (string headPositionString in headPositionObjectName.Split(','))
{
GameObject headPositionObject = GameObject.Find(headPositionString);
if (headPositionObject != null)
{
headPositionObjectArray.Add(headPositionObject);
}
}
}
void ThreadMethod()
{
//Process once every 5ms
long next = DateTime.Now.Ticks + 50000;
long now;
while (true)
{
try
{
IPEndPoint remoteEP = null;
byte[] data = udp.Receive(ref remoteEP);
messageString = Encoding.ASCII.GetString(data);
}
catch
{
}
do
{
now = DateTime.Now.Ticks;
}
while (now < next);
next += 50000;
}
}
public string GetMessageString()
{
return messageString;
}
void OnEnable()
{
StartFunction();
}
void OnDisable()
{
try
{
OnApplicationQuit();
}
catch
{
}
}
void OnApplicationQuit()
{
if (StartFlag == false)
{
StartFlag = true;
StopUDP();
}
}
public void StopUDP()
{
if (gameStartWithConnect == true)
{
StopStreaming_iOS_App();
}
udp.Dispose();
thread.Abort();
}
private bool HasBlendShapes(SkinnedMeshRenderer skin)
{
if (!skin.sharedMesh)
{
return false;
}
if (skin.sharedMesh.blendShapeCount <= 0)
{
return false;
}
return true;
}
}
public static class FM3D_and_iFacialMocap_GetAllChildren
{
public static List<GameObject> GetAll(this GameObject obj)
{
List<GameObject> allChildren = new List<GameObject>();
allChildren.Add(obj);
GetChildren(obj, ref allChildren);
return allChildren;
}
public static void GetChildren(GameObject obj, ref List<GameObject> allChildren)
{
Transform children = obj.GetComponentInChildren<Transform>();
if (children.childCount == 0)
{
return;
}
foreach (Transform ob in children)
{
allChildren.Add(ob.gameObject);
GetChildren(ob.gameObject, ref allChildren);
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c942f7bd108ef2a4c96caa6aa3f10d03

8
Assets/External/MagicaCloth2.meta vendored Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f31820b1e966ca049a982e2a30795d24
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b13ad20384f6dd8459a0ee155e8181f1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 791ca5043c61c164093a43f6e1134756
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 319509eb5d501a04f8a0d2e3a8f5b0a0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,202 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-5413520746483021427
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 12
hdPluginSubTargetMaterialVersions:
m_Keys: []
m_Values:
--- !u!114 &-3015027763282864326
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9
--- !u!114 &-2537191031519904044
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 0
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MC2_Floor
m_Shader: {fileID: -6465566751694194690, guid: e0b73429f84a56840ba17b216237f806, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _DISABLE_SSR_TRANSPARENT
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap:
MotionVector: User
disabledShaderPasses:
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
- RayTracingPrepass
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Main:
m_Texture: {fileID: 10309, guid: 0000000000000000f000000000000000, type: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaCutoffEnable: 0
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _AlphaToMask: 0
- _AlphaToMaskInspectorValue: 0
- _BUILTIN_QueueControl: 0
- _BUILTIN_QueueOffset: 0
- _BlendMode: 0
- _BumpScale: 1
- _ConservativeDepthOffsetEnable: 0
- _CullMode: 2
- _CullModeForward: 2
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailNormalMapScale: 1
- _DoubleSidedEnable: 0
- _DoubleSidedGIMode: 0
- _DoubleSidedNormalMode: 2
- _DstBlend: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _OpaqueCullMode: 2
- _Parallax: 0.02
- _QueueControl: 1
- _QueueOffset: 0
- _RayTracing: 0
- _ReceivesSSR: 1
- _ReceivesSSRTransparent: 0
- _RefractionModel: 0
- _RenderQueueType: 1
- _RequireSplitLighting: 0
- _Smoothness: 0
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 8
- _StencilRefDistortionVec: 4
- _StencilRefGBuffer: 10
- _StencilRefMV: 40
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskDistortionVec: 4
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _SupportDecals: 1
- _SurfaceType: 0
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 0
- _TransparentDepthPrepassEnable: 0
- _TransparentSortPriority: 0
- _TransparentWritingMotionVec: 0
- _TransparentZWrite: 0
- _UVSec: 0
- _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestTransparent: 4
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.14150941, g: 0.14150941, b: 0.14150941, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _Tiling: {r: 100, g: 100, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a8d0a0ce31bbbd49ad39beb17ee9326
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,202 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MC2_Test_Back
m_Shader: {fileID: -6465566751694194690, guid: b969454d26657854a8fe82c813fb0876, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _DISABLE_SSR_TRANSPARENT
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2450
stringTagMap:
MotionVector: User
disabledShaderPasses:
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
- RayTracingPrepass
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Main:
m_Texture: {fileID: 10309, guid: 0000000000000000f000000000000000, type: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaCutoffEnable: 0
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _AlphaToMask: 0
- _AlphaToMaskInspectorValue: 0
- _BUILTIN_QueueControl: 0
- _BUILTIN_QueueOffset: 0
- _BlendMode: 0
- _BumpScale: 1
- _ConservativeDepthOffsetEnable: 0
- _CullMode: 1
- _CullModeForward: 1
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailNormalMapScale: 1
- _DoubleSidedEnable: 0
- _DoubleSidedGIMode: 0
- _DoubleSidedNormalMode: 2
- _DstBlend: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _OpaqueCullMode: 1
- _Parallax: 0.02
- _QueueControl: 1
- _QueueOffset: 0
- _RayTracing: 0
- _ReceivesSSR: 1
- _ReceivesSSRTransparent: 0
- _RefractionModel: 0
- _RenderQueueType: 1
- _RequireSplitLighting: 0
- _Smoothness: 0
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 8
- _StencilRefDistortionVec: 4
- _StencilRefGBuffer: 10
- _StencilRefMV: 40
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskDistortionVec: 4
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _SupportDecals: 1
- _SurfaceType: 0
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 0
- _TransparentDepthPrepassEnable: 0
- _TransparentSortPriority: 0
- _TransparentWritingMotionVec: 0
- _TransparentZWrite: 0
- _UVSec: 0
- _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestTransparent: 4
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _Tiling: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &542807876330787821
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 12
hdPluginSubTargetMaterialVersions:
m_Keys: []
m_Values:
--- !u!114 &5888084634695096061
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 0
--- !u!114 &7297074712781543736
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 586d53852ab2fac4cba5cac70300497d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,202 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2678523629483602278
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MC2_Test_Front
m_Shader: {fileID: -6465566751694194690, guid: e0b73429f84a56840ba17b216237f806, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _DISABLE_SSR_TRANSPARENT
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap:
MotionVector: User
disabledShaderPasses:
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
- RayTracingPrepass
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Main:
m_Texture: {fileID: 10309, guid: 0000000000000000f000000000000000, type: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaCutoffEnable: 0
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _AlphaToMask: 0
- _AlphaToMaskInspectorValue: 0
- _BUILTIN_QueueControl: 0
- _BUILTIN_QueueOffset: 0
- _BlendMode: 0
- _BumpScale: 1
- _ConservativeDepthOffsetEnable: 0
- _CullMode: 2
- _CullModeForward: 2
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailNormalMapScale: 1
- _DoubleSidedEnable: 0
- _DoubleSidedGIMode: 0
- _DoubleSidedNormalMode: 2
- _DstBlend: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _OpaqueCullMode: 2
- _Parallax: 0.02
- _QueueControl: 1
- _QueueOffset: 0
- _RayTracing: 0
- _ReceivesSSR: 1
- _ReceivesSSRTransparent: 0
- _RefractionModel: 0
- _RenderQueueType: 1
- _RequireSplitLighting: 0
- _Smoothness: 0
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 8
- _StencilRefDistortionVec: 4
- _StencilRefGBuffer: 10
- _StencilRefMV: 40
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskDistortionVec: 4
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _SupportDecals: 1
- _SurfaceType: 0
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 0
- _TransparentDepthPrepassEnable: 0
- _TransparentSortPriority: 0
- _TransparentWritingMotionVec: 0
- _TransparentZWrite: 0
- _UVSec: 0
- _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestTransparent: 4
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _Tiling: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &3436996967411815949
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 12
hdPluginSubTargetMaterialVersions:
m_Keys: []
m_Values:
--- !u!114 &5888084634695096061
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e668c51d0e0125e4dbae8a37cb0d45e4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,133 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-39192238385914524
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MC2_White
m_Shader: {fileID: -6465566751694194690, guid: e0b73429f84a56840ba17b216237f806, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Main:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BUILTIN_QueueControl: 0
- _BUILTIN_QueueOffset: 0
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueControl: 0
- _QueueOffset: 0
- _Smoothness: 0
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.6886792, g: 0.6886792, b: 0.6886792, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Tiling: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &5537520944958903688
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9dc80f717b8cf0f44a1328de60c05a87
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 174ae74532988144eaa22b5d3ce3b54b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e22374f5956c7fe49ba058092885078b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,151 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Arrow
m_Shader: {fileID: -6465566751694194690, guid: e0b73429f84a56840ba17b216237f806, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Main:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _BUILTIN_QueueControl: 0
- _BUILTIN_QueueOffset: 0
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.8, g: 0.8, b: 0.8, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _Tiling: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &7761228438660005603
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9
--- !u!114 &8771852287512767389
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9d8e9d2536fe10f448a1440c26ec0bc3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: 40f00d3ed65180f4ab14accca4d78735
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2100000: Arrow
2300000: //RootNode
3300000: //RootNode
4300000: Arrow
externalObjects: {}
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
materialLocation: 0
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 1
hasPreviousCalculatedGlobalScale: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f43ab23790f02b24aa62d451e140d7ce
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: baaebd372fee4154e9b08570bc3a230e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1950e99f479bef04581d5185a7cf27b3
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b5bac44e9cdf69541b2d1de75e68a9ba
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f6e49ec628143df48a1d0a213fc770af
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 57eb8094dff10c34f8fae441c280e0f8
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bca76fc2423c0a14db7d44f7745ab286
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e35153ae4a19fa24289b796a4290d4db
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 23be23f56fcb4ac48ac4de26c111e332
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 94ed6a8f5c3a2ba4d8c93972af7467f0
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0b388bd66f5736b4891ceafcaee539a4
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 228b0487b4c6f43448267a8277251bc6
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b10f69e1744a07942843e8c00f85501e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c421f5fd48afe284da1a2c74a043723b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9f50911cfd816e840860425faa5cec57
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 983f0ab2563c0d34eb966719207674dc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9cb18a57f012d144480f025bca639032
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2ccf7a2872d9e554ea3511882b07a3e7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,41 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using UnityEngine;
namespace MagicaCloth2
{
public class AutoRotate : MonoBehaviour
{
public Vector3 eulers = new Vector3(0, 90, 0);
public Space space = Space.World;
[SerializeField]
[Range(0.1f, 5.0f)]
private float interval = 2.0f;
public bool useSin = true;
private float time = 0;
void Update()
{
if (useSin)
{
time += Time.deltaTime;
float ang = (time % interval) / interval * Mathf.PI * 2.0f;
var t = Mathf.Sin(ang);
if (space == Space.World)
transform.eulerAngles = eulers * t;
else
transform.localEulerAngles = eulers * t;
}
else
{
transform.Rotate(eulers * Time.deltaTime, space);
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4124c59241137374c9cae45d25683042
timeCreated: 1510336570
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,244 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using UnityEngine;
namespace MagicaCloth2
{
/// <summary>
/// カメラ回転
/// </summary>
public class CameraOrbit : MonoBehaviour
{
[SerializeField]
private Transform cameraTransform;
[Header("Camera Target")]
public Transform cameraTarget;
public Vector3 cameraTargetPos;
public Vector3 cameraTargetOffset;
[Header("Now Position")]
[SerializeField]
private float cameraDist = 1.5f;
[SerializeField]
private float cameraPitch = 21.0f;
[SerializeField]
private float cameraYaw = 180.0f;
[Header("Parameter")]
[SerializeField]
private float cameraDistHokanTime = 0.1f;
[SerializeField]
private float cameraAngleHokanTime = 0.1f;
[SerializeField]
private float cameraDistSpeed = 0.02f;
[SerializeField]
private float cameraDistMax = 8.0f;
[SerializeField]
private float cameraDistMin = 0.1f;
[SerializeField]
private float cameraYawSpeed = 0.3f;
[SerializeField]
private float cameraPitchSpeed = 0.3f;
[SerializeField]
private float cameraMaxAngleSpeed = 100.0f;
[SerializeField]
private float cameraPitchMax = 89.0f;
[SerializeField]
private float cameraPitchMin = -89.0f;
// 中ボタンドラッグによる移動
public enum MoveMode
{
None,
UpDown,
Free,
}
[SerializeField]
private MoveMode moveMode = MoveMode.Free;
[SerializeField]
private float moveSpeed = 0.002f;
// 自動回転
[Header("Auto Rotation")]
[SerializeField]
private bool useAutoRotation = false;
[SerializeField]
private float autoRotationSpeed = 90.0f;
// 移動作業用
private float setCameraDist;
private float setCameraPitch;
private float setCameraYaw;
private float cameraDistVelocity;
private float cameraPitchVelocity;
private float cameraYawVelocity;
private float offsetYaw;
void Start()
{
if (cameraTransform == null)
{
var cam = GetComponent<Camera>();
if (cam)
cameraTransform = cam.transform;
}
if (cameraTransform == null)
enabled = false;
setCameraDist = cameraDist;
setCameraPitch = cameraPitch;
setCameraYaw = cameraYaw;
}
void OnEnable()
{
// 入力イベント登録
SimpleInputManager.OnTouchMove += OnTouchMove;
SimpleInputManager.OnDoubleTouchMove += OnDoubleTouchMove;
SimpleInputManager.OnTouchPinch += OnTouchPinch;
}
void OnDisable()
{
// 入力イベント解除
SimpleInputManager.OnTouchMove -= OnTouchMove;
SimpleInputManager.OnDoubleTouchMove -= OnDoubleTouchMove;
SimpleInputManager.OnTouchPinch -= OnTouchPinch;
}
void LateUpdate()
{
// カメラ更新
updateCamera();
}
// カメラ更新
private void updateCamera()
{
if (cameraTransform == null)
return;
// カメラターゲットポジション
if (cameraTarget)
{
cameraTargetPos = cameraTarget.position;
}
// 補間
cameraDist = Mathf.SmoothDamp(cameraDist, setCameraDist, ref cameraDistVelocity, cameraDistHokanTime);
cameraPitch = Mathf.SmoothDampAngle(cameraPitch, setCameraPitch, ref cameraPitchVelocity, cameraAngleHokanTime);
cameraYaw = Mathf.SmoothDampAngle(cameraYaw, setCameraYaw, ref cameraYawVelocity, cameraAngleHokanTime);
// 自動回転
if (useAutoRotation)
{
offsetYaw += autoRotationSpeed * Time.deltaTime;
}
// 座標確定
Quaternion q = Quaternion.Euler(cameraPitch, cameraYaw + offsetYaw, 0);
q = transform.rotation * q; // コンポーネントの回転
Vector3 v = new Vector3(0, 0, -cameraDist);
Vector3 pos = q * v;
// ターゲットポジション
Vector3 tarpos = cameraTargetPos + cameraTargetOffset;
Vector3 fixpos = tarpos + pos;
cameraTransform.localPosition = fixpos;
// 回転確定
Vector3 relativePos = tarpos - cameraTransform.position;
Quaternion rot = Quaternion.LookRotation(relativePos);
cameraTransform.rotation = rot;
}
// 回転操作
private void updatePitchYaw(Vector2 speed)
{
// Yaw
setCameraYaw += speed.x * cameraYawSpeed;
// Pitch
setCameraPitch += -speed.y * cameraPitchSpeed;
setCameraPitch = Mathf.Clamp(setCameraPitch, cameraPitchMin, cameraPitchMax);
}
// 移動操作
private void updateOffset(Vector2 speed)
{
if (cameraTransform == null)
{
return;
}
if (moveMode == MoveMode.UpDown)
{
cameraTargetOffset.y -= speed.y * moveSpeed;
}
else if (moveMode == MoveMode.Free)
{
Vector3 offset = cameraTransform.up * -speed.y * moveSpeed;
offset += cameraTransform.right * -speed.x * moveSpeed;
cameraTargetOffset += offset;
}
}
// ズーム操作
private void updateZoom(float speed)
{
float value = speed * cameraDistSpeed;
float scl = Mathf.InverseLerp(cameraDistMin, cameraDistMax, setCameraDist);
scl = Mathf.Clamp(scl, 0.1f, 1.0f);
setCameraDist -= value * scl;
setCameraDist = Mathf.Clamp(setCameraDist, cameraDistMin, cameraDistMax);
}
//=============================================================================================
/// <summary>
/// 入力通知:移動
/// </summary>
/// <param name="screenPos"></param>
/// <param name="screenVelocity"></param>
private void OnTouchMove(int fid, Vector2 screenPos, Vector2 screenVelocity, Vector2 cmVelocity)
{
screenVelocity *= Time.deltaTime * 60.0f;
if (fid == 2)
{
// 中ドラッグ
updateOffset(screenVelocity);
}
else if (fid == 0)
{
// 左ドラッグ
// 最大速度
screenVelocity = Vector2.ClampMagnitude(screenVelocity, cameraMaxAngleSpeed);
updatePitchYaw(screenVelocity);
}
}
private void OnDoubleTouchMove(int fid, Vector2 screenPos, Vector2 screenVelocity, Vector2 cmVelocity)
{
if (SimpleInputManager.Instance.GetTouchCount() >= 3)
updateOffset(screenVelocity);
}
/// <summary>
/// 入力通知:ピンチイン/アウト
/// </summary>
/// <param name="speedscr"></param>
/// <param name="speedcm"></param>
private void OnTouchPinch(float speedscr, float speedcm)
{
//if (Mathf.Abs(speedcm) > 1.0f)
if (SimpleInputManager.Instance.GetTouchCount() < 3)
updateZoom(speedcm);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1fd18111ed866534a92d0a2a59d1608d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,134 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using UnityEngine;
namespace MagicaCloth2
{
/// <summary>
/// 基本的なシングルトンテンプレート
/// ・シーンに無い場合は作成する
/// ・自動初期化呼び出し機能
/// ・DontDestroyOnLoad設定
/// ・実行前でもInstanceアクセス可能
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class CreateSingleton<T> : MonoBehaviour where T : MonoBehaviour
{
private static T instance;
/// <summary>
/// 初期化フラグ
/// </summary>
private static T initInstance;
private static bool isDestroy;
/// <summary>
/// Reload Domain 対応
/// ※残念ながらジェネリッククラスでは[RuntimeInitializeOnLoadMethod]が利用できないため、
/// この初期化関数を派生元で[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
/// を使用して呼び出さなければならない
/// </summary>
protected static void InitMember()
{
instance = null;
initInstance = null;
isDestroy = false;
}
public static T Instance
{
get
{
if (instance == null)
{
// FindObjectOfTypeはそれなりに負荷がかかるので注意
// 非アクティブのオブジェクトは発見できないので注意!
#if UNITY_2023_1_OR_NEWER
instance = FindFirstObjectByType<T>();
#else
instance = FindObjectOfType<T>();
#endif
if (instance == null && Application.isPlaying)
{
var obj = new GameObject(typeof(T).Name);
instance = obj.AddComponent<T>();
}
}
// 初期化
InitInstance();
return instance;
}
}
private static void InitInstance()
{
if (initInstance == null && instance != null && Application.isPlaying)
{
// シーン切り替えでもオブジェクトが消えないように設定
//DontDestroyOnLoad(instance.gameObject);
// 初期化呼び出し
var s = instance as CreateSingleton<T>;
s.InitSingleton();
initInstance = instance;
}
}
/// <summary>
/// インスタンスが存在する場合にTrueを返します
/// </summary>
/// <returns></returns>
public static bool IsInstance()
{
return instance != null && isDestroy == false;
}
/// <summary>
/// Awake()でのインスタンス設定
/// </summary>
protected virtual void Awake()
{
if (instance == null)
{
instance = this as T;
InitInstance();
}
else if (instance != this)
{
// 2つ目のコンポーネントを発見
var s = instance as CreateSingleton<T>;
s.DuplicateDetection(this as T);
// 2つ目のコンポーネントは破棄する
Destroy(this.gameObject);
}
}
protected virtual void OnDestroy()
{
// インスタンスクラスならば無効化フラグを立てる
if (instance == this)
{
isDestroy = true;
}
}
/// <summary>
/// 2つ目の破棄されるコンポーネントを通知
/// </summary>
/// <param name="duplicate"></param>
protected virtual void DuplicateDetection(T duplicate) { }
/// <summary>
/// 内部初期化
/// </summary>
protected abstract void InitSingleton();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0d1b801c369005647ae0e5a315e0bdaf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 776d5a1b173ef154c9bef26d30c53fcc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 347fb6ccc378d9442a92b5316d0ff7c9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
{
"name": "MagicaCloth2UPMImporterShaderGraph",
"rootNamespace": "",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"!MC2_SHADERGRAPH"
],
"versionDefines": [
{
"name": "com.unity.shadergraph",
"expression": "12.0.0",
"define": "MC2_SHADERGRAPH"
}
],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 34d2974f64e7a9f49a48b400abf046ff
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,30 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using UnityEditor;
using UnityEditor.PackageManager;
using UnityEngine;
namespace MagicaCloth2UPMImporterCollections
{
/// <summary>
/// 必要なUnityPackageの自動インストール
/// </summary>
[InitializeOnLoad]
public static class UnityPackageImporter
{
static UnityPackageImporter()
{
Install("com.unity.shadergraph");
}
public static bool Install(string id)
{
Debug.Log($"Install...{id}");
var request = Client.Add(id);
while (!request.IsCompleted) { };
if (request.Error != null) Debug.LogError(request.Error.message);
return request.Error == null;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dd5d6386919360640adca6564193a8f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,44 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using System.Collections.Generic;
using UnityEngine;
namespace MagicaCloth2
{
public class GameObjectContainer : MonoBehaviour
{
[SerializeField]
private List<GameObject> gameObjectList = new List<GameObject>();
private Dictionary<string, GameObject> gameObjectDict = new Dictionary<string, GameObject>();
private void Awake()
{
// create dictionary.
foreach (var obj in gameObjectList)
{
if (obj)
{
gameObjectDict.Add(obj.name, obj);
}
}
}
public bool Contains(string objName)
{
return gameObjectDict.ContainsKey(objName);
}
public GameObject GetGameObject(string objName)
{
if (gameObjectDict.ContainsKey(objName))
{
return gameObjectDict[objName];
}
else
return null;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4357444b3effcf149a7c0557d3c4ddc5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,85 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using System.Collections.Generic;
using UnityEngine;
namespace MagicaCloth2
{
public class ModelController : MonoBehaviour
{
[SerializeField]
private List<GameObject> characterList = new List<GameObject>();
[SerializeField]
private float slowTime = 0.1f;
private bool slow;
void Start()
{
}
void Update()
{
}
private void AnimatorAction(System.Action<Animator> act)
{
foreach (var chara in characterList)
{
if (chara && chara.activeInHierarchy)
{
var animator = chara.GetComponent<Animator>();
if (animator)
{
act(animator);
}
}
}
}
private void ClothAction(System.Action<MagicaCloth> act)
{
foreach (var chara in characterList)
{
if (chara && chara.activeInHierarchy)
{
var clothList = chara.GetComponentsInChildren<MagicaCloth>(true);
if (clothList != null)
{
foreach (var cloth in clothList)
{
act(cloth);
}
}
}
}
}
public void OnNextButton()
{
AnimatorAction((ani) => ani.SetTrigger("Next"));
}
public void OnBackButton()
{
AnimatorAction((ani) => ani.SetTrigger("Back"));
}
public void OnSlowButton()
{
slow = !slow;
float timeScale = slow ? slowTime : 1.0f;
AnimatorAction((ani) => ani.speed = timeScale);
ClothAction((cloth) => cloth.SetTimeScale(timeScale));
}
public void OnActiveButton()
{
ClothAction((cloth) => cloth.gameObject.SetActive(!cloth.gameObject.activeSelf));
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 49572a6b5327127438636ad59bdb9226
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,259 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using UnityEngine;
namespace MagicaCloth2
{
/// <summary>
/// A sample that builds MagicaCloth at runtime.
/// </summary>
public class RuntimeBuildDemo : MonoBehaviour
{
[SerializeField]
private GameObject characterPrefab;
[SerializeField]
private MagicaCloth frontHairSource;
[SerializeField]
private string ribbonPresetName;
[SerializeField]
private string skirtName;
[SerializeField]
private Texture2D skirtPaintMap;
GameObject character;
GameObjectContainer gameObjectContainer;
void Start()
{
}
void Update()
{
}
public void OnCreateButton()
{
if (character)
return;
// Generate a character from a prefab.
GenerateCharacter();
// BoneCloth construction example (1).
SetupHairTail_BoneCloth();
// BoneCloth construction example (2).
SetupFrontHair_BoneCloth();
// BoneCloth construction example (3).
SetupRibbon_BoneCloth();
// MeshCloth construction example (1).
SetupSkirt_MeshCloth();
}
public void OnRemoveButton()
{
if (character)
{
Destroy(character);
character = null;
gameObjectContainer = null;
}
}
/// <summary>
/// Generate a character from a prefab.
/// A character already contains a<GameObjectContainer> to reference a GameObject.
/// This component is optional.
/// It's just there to help with data construction.
/// </summary>
void GenerateCharacter()
{
if (characterPrefab)
{
character = Instantiate(characterPrefab, transform);
gameObjectContainer = character.GetComponent<GameObjectContainer>();
}
}
/// <summary>
/// BoneCloth construction example (1).
/// Set all parameters from a script.
/// </summary>
void SetupHairTail_BoneCloth()
{
if (character == null)
return;
var obj = new GameObject("HairTail_BoneCloth");
obj.transform.SetParent(character.transform, false);
// add Magica Cloth
var cloth = obj.AddComponent<MagicaCloth>();
var sdata = cloth.SerializeData;
// bone cloth
sdata.clothType = ClothProcess.ClothType.BoneCloth;
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_L_HairTail_00_B").transform);
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_R_HairTail_00_B").transform);
// setup parameters
sdata.gravity = 3.0f;
sdata.damping.SetValue(0.05f);
sdata.angleRestorationConstraint.stiffness.SetValue(0.15f, 1.0f, 0.15f, true);
sdata.angleRestorationConstraint.velocityAttenuation = 0.6f;
sdata.tetherConstraint.distanceCompression = 0.5f;
sdata.inertiaConstraint.particleSpeedLimit.SetValue(true, 3.0f);
sdata.colliderCollisionConstraint.mode = ColliderCollisionConstraint.Mode.None;
// start build
cloth.BuildAndRun();
}
/// <summary>
/// BoneCloth construction example (2).
/// Copy parameters from an existing component.
/// </summary>
void SetupFrontHair_BoneCloth()
{
if (character == null || frontHairSource == null)
return;
var obj = new GameObject("HairFront_BoneCloth");
obj.transform.SetParent(character.transform, false);
// add Magica Cloth
var cloth = obj.AddComponent<MagicaCloth>();
var sdata = cloth.SerializeData;
// bone cloth
sdata.clothType = ClothProcess.ClothType.BoneCloth;
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_L_HairFront_00_B").transform);
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_L_HairSide2_00_B").transform);
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_L_HairSide_00_B").transform);
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_R_HairFront_00_B").transform);
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_R_HairSide2_00_B").transform);
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_R_HairSide_00_B").transform);
// Normal direction setting for backstop
sdata.normalAlignmentSetting.alignmentMode = NormalAlignmentSettings.AlignmentMode.Transform;
sdata.normalAlignmentSetting.adjustmentTransform = gameObjectContainer.GetGameObject("HeadCenter").transform;
// setup parameters
// Copy from source settings
sdata.Import(frontHairSource, false);
// start build
cloth.BuildAndRun();
}
/// <summary>
/// BoneCloth construction example (3).
/// Load parameters from saved presets.
/// </summary>
void SetupRibbon_BoneCloth()
{
if (character == null || string.IsNullOrEmpty(ribbonPresetName))
return;
var obj = new GameObject("Ribbon_BoneCloth");
obj.transform.SetParent(character.transform, false);
// add Magica Cloth
var cloth = obj.AddComponent<MagicaCloth>();
var sdata = cloth.SerializeData;
// bone cloth
sdata.clothType = ClothProcess.ClothType.BoneCloth;
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_L_HeadRibbon_00_B").transform);
sdata.rootBones.Add(gameObjectContainer.GetGameObject("J_R_HeadRibbon_00_B").transform);
// setup parameters
// Load presets from the Resource folder.
// Since presets are in TextAssets format, they can also be used as asset bundles.
var presetText = Resources.Load<TextAsset>(ribbonPresetName);
sdata.ImportJson(presetText.text);
// start build
cloth.BuildAndRun();
}
/// <summary>
/// MeshCloth construction example (1).
/// Reads vertex attributes from a paintmap.
/// </summary>
void SetupSkirt_MeshCloth()
{
if (character == null || skirtPaintMap == null)
return;
// skirt renderer
var sobj = gameObjectContainer.GetGameObject(skirtName);
if (sobj == null)
return;
Renderer skirtRenderer = sobj.GetComponent<Renderer>();
if (skirtRenderer == null)
return;
// add Magica Cloth
var obj = new GameObject("Skirt_MeshCloth");
obj.transform.SetParent(character.transform, false);
var cloth = obj.AddComponent<MagicaCloth>();
var sdata = cloth.SerializeData;
// mesh cloth
sdata.clothType = ClothProcess.ClothType.MeshCloth;
sdata.sourceRenderers.Add(skirtRenderer);
// reduction settings
sdata.reductionSetting.simpleDistance = 0.0212f;
sdata.reductionSetting.shapeDistance = 0.0244f;
// paint map settings
// *** Paintmaps must have Read/Write attributes enabled! ***
sdata.paintMode = ClothSerializeData.PaintMode.Texture_Fixed_Move;
sdata.paintMaps.Add(skirtPaintMap);
// setup parameters
sdata.gravity = 1.0f;
sdata.damping.SetValue(0.03f);
sdata.angleRestorationConstraint.stiffness.SetValue(0.05f, 1.0f, 0.5f, true);
sdata.angleRestorationConstraint.velocityAttenuation = 0.5f;
sdata.angleLimitConstraint.useAngleLimit = true;
sdata.angleLimitConstraint.limitAngle.SetValue(45.0f, 0.0f, 1.0f, true);
sdata.distanceConstraint.stiffness.SetValue(0.5f, 1.0f, 0.5f, true);
sdata.tetherConstraint.distanceCompression = 0.9f;
sdata.inertiaConstraint.depthInertia = 0.7f;
sdata.inertiaConstraint.movementSpeedLimit.SetValue(true, 3.0f);
sdata.inertiaConstraint.particleSpeedLimit.SetValue(true, 3.0f);
sdata.colliderCollisionConstraint.mode = ColliderCollisionConstraint.Mode.Point;
// setup collider
var lobj = new GameObject("CapsuleCollider_L");
lobj.transform.SetParent(gameObjectContainer.GetGameObject("Character1_LeftUpLeg").transform);
lobj.transform.localPosition = new Vector3(0.0049f, 0.0f, -0.0832f);
lobj.transform.localEulerAngles = new Vector3(0.23f, 16.376f, -0.028f);
var colliderL = lobj.AddComponent<MagicaCapsuleCollider>();
colliderL.direction = MagicaCapsuleCollider.Direction.Z;
colliderL.SetSize(0.082f, 0.094f, 0.3f);
var robj = new GameObject("CapsuleCollider_R");
robj.transform.SetParent(gameObjectContainer.GetGameObject("Character1_RightUpLeg").transform);
robj.transform.localPosition = new Vector3(-0.0049f, 0.0f, -0.0832f);
robj.transform.localEulerAngles = new Vector3(0.23f, -16.376f, -0.028f);
var colliderR = robj.AddComponent<MagicaCapsuleCollider>();
colliderR.direction = MagicaCapsuleCollider.Direction.Z;
colliderR.SetSize(0.082f, 0.094f, 0.3f);
sdata.colliderCollisionConstraint.colliderList.Add(colliderL);
sdata.colliderCollisionConstraint.colliderList.Add(colliderR);
// start build
cloth.BuildAndRun();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d0126e2925cecdf4a933c28a27f415ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,220 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using System.Collections.Generic;
using UnityEngine;
namespace MagicaCloth2
{
/// <summary>
/// Dress-up sample.
/// </summary>
public class RuntimeDressUpDemo : MonoBehaviour
{
/// <summary>
/// Avatar to change clothes.
/// </summary>
public GameObject targetAvatar;
/// <summary>
/// Hair prefab with MagicaCloth set in advance.
/// </summary>
public GameObject hariEqupPrefab;
/// <summary>
/// Clothes prefab with MagicaCloth set in advance.
/// </summary>
public GameObject bodyEquipPrefab;
//=========================================================================================
/// <summary>
/// Bones dictionary of avatars to dress up.
/// </summary>
Dictionary<string, Transform> targetAvatarBoneMap = new Dictionary<string, Transform>();
/// <summary>
/// Information class for canceling dress-up.
/// </summary>
class EquipInfo
{
public GameObject equipObject;
public List<ColliderComponent> colliderList;
public bool IsValid() => equipObject != null;
}
EquipInfo hairEquipInfo = new EquipInfo();
EquipInfo bodyEquipInfo = new EquipInfo();
//=========================================================================================
private void Awake()
{
Init();
}
void Start()
{
}
void Update()
{
}
//=========================================================================================
public void OnHairEquipButton()
{
if (hairEquipInfo.IsValid())
Remove(hairEquipInfo);
else
Equip(hariEqupPrefab, hairEquipInfo);
}
public void OnBodyEquipButton()
{
if (bodyEquipInfo.IsValid())
Remove(bodyEquipInfo);
else
Equip(bodyEquipPrefab, bodyEquipInfo);
}
//=========================================================================================
/// <summary>
/// Create an avatar bone dictionary in advance.
/// </summary>
void Init()
{
Debug.Assert(targetAvatar);
// Create all bone maps for the target avatar
foreach (Transform bone in targetAvatar.GetComponentsInChildren<Transform>())
{
if (targetAvatarBoneMap.ContainsKey(bone.name) == false)
{
targetAvatarBoneMap.Add(bone.name, bone);
}
else
{
Debug.Log($"Duplicate bone name :{bone.name}");
}
}
}
/// <summary>
/// Equip clothes.
/// </summary>
/// <param name="equipPrefab"></param>
/// <param name="einfo"></param>
void Equip(GameObject equipPrefab, EquipInfo einfo)
{
Debug.Assert(equipPrefab);
// Generate a prefab with cloth set up.
var gobj = Instantiate(equipPrefab, targetAvatar.transform);
// All cloth components included in the prefab.
var clothList = new List<MagicaCloth>(gobj.GetComponentsInChildren<MagicaCloth>());
// All collider components included in the prefab.
var colliderList = new List<ColliderComponent>(gobj.GetComponentsInChildren<ColliderComponent>());
// All renderers included in the prefab.
var skinList = new List<SkinnedMeshRenderer>(gobj.GetComponentsInChildren<SkinnedMeshRenderer>());
// First stop the automatic build that is executed with Start().
// And just in case, it does some initialization called Awake().
foreach (var cloth in clothList)
{
// Normally it is called with Awake(), but if the component is disabled, it will not be executed, so call it manually.
// Ignored if already run with Awake().
cloth.Initialize();
// Turn off auto-build on Start().
cloth.DisableAutoBuild();
}
// Swap the bones of the SkinnedMeshRenderer.
// This process is a general dress-up process for SkinnedMeshRenderer.
// Comment out this series of processes when performing this process with functions such as other assets.
foreach (var sren in skinList)
{
var bones = sren.bones;
Transform[] newBones = new Transform[bones.Length];
for (int i = 0; i < bones.Length; ++i)
{
Transform bone = bones[i];
if (!targetAvatarBoneMap.TryGetValue(bone.name, out newBones[i]))
{
// Is the bone the renderer itself?
if (bone.name == sren.name)
{
newBones[i] = sren.transform;
}
else
{
// bone not found
Debug.Log($"[SkinnedMeshRenderer({sren.name})] Unable to map bone [{bone.name}] to target skeleton.");
}
}
}
sren.bones = newBones;
// root bone
if (targetAvatarBoneMap.ContainsKey(sren.rootBone?.name))
{
sren.rootBone = targetAvatarBoneMap[sren.rootBone.name];
}
}
// Here, replace the bones used by the MagicaCloth component.
foreach (var cloth in clothList)
{
// Replaces a component's transform.
cloth.ReplaceTransform(targetAvatarBoneMap);
}
// Move all colliders to the new avatar.
foreach (var collider in colliderList)
{
Transform parent = collider.transform.parent;
if (parent && targetAvatarBoneMap.ContainsKey(parent.name))
{
Transform newParent = targetAvatarBoneMap[parent.name];
// After changing the parent, you need to write back the local posture and align it.
var localPosition = collider.transform.localPosition;
var localRotation = collider.transform.localRotation;
collider.transform.SetParent(newParent);
collider.transform.localPosition = localPosition;
collider.transform.localRotation = localRotation;
}
}
// Finally let's start building the cloth component.
foreach (var cloth in clothList)
{
// I disabled the automatic build, so I build it manually.
cloth.BuildAndRun();
}
// Record information for release.
einfo.equipObject = gobj;
einfo.colliderList = colliderList;
}
/// <summary>
/// Removes equipped clothing.
/// </summary>
/// <param name="einfo"></param>
void Remove(EquipInfo einfo)
{
Destroy(einfo.equipObject);
foreach (var c in einfo.colliderList)
{
Destroy(c.gameObject);
}
einfo.equipObject = null;
einfo.colliderList.Clear();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e72f8cfc2a22d184e86b4e1905cdf3ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,600 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
namespace MagicaCloth2
{
/// <summary>
/// 入力マネージャ
/// ・簡単なタップやフリック判定
/// ・PCの場合はマウスによる自動エミュレーション
/// </summary>
public class SimpleInputManager : CreateSingleton<SimpleInputManager>
{
// 最大タッチ数
private const int MaxFinger = 3;
/// <summary>
/// タップ有効半径(cm)
/// </summary>
public float tapRadiusCm = 0.5f;
/// <summary>
/// フリック判定距離(cm)
/// </summary>
public float flickRangeCm = 0.01f;
/// <summary>
/// フリック判定速度(cm/s)
/// </summary>
public float flickCheckSpeed = 1.0f;
/// <summary>
/// マウスホイールのピンチイン・ピンチアウト速度係数
/// </summary>
public float mouseWheelSpeed = 5.0f;
// 入力情報管理
private int mainFingerId = -1;
private int subFingerId = -1;
private Vector2[] downPos; // 入力開始座標(スクリーン)
private Vector2[] lastPos;
private Vector2[] flickDownPos; // 入力開始座標(スクリーン)
private float[] flickDownTime;
private float lastTime = 0; // バックボタンの連続入力防止用
// モバイル情報管理
private bool mobilePlatform = false;
// マウスエミュレーション情報管理
private bool[] mouseDown;
private Vector2[] mouseOldMovePos;
// モニタ情報
private float screenDpi; // スクリーンDPI値
private float screenDpc; // スクリーンDots per cm値当たりのピクセル数
//------------------------------ モバイルタッチパネル/マウスエミュレーション ------------------
// タッチ開始通知
// タッチされた時に、フィンガーID、その位置スクリーンを通知します。
public static UnityAction<int, Vector2> OnTouchDown;
// 移動通知
// タッチされたまま移動された場合に、フィンガーID、その位置スクリーン、速度(スクリーン比率/s)、速度(cm/s)を通知します。
public static UnityAction<int, Vector2, Vector2, Vector2> OnTouchMove;
// ダブルタッチされたまま移動された場合に、フィンガーID、その位置スクリーン、速度(スクリーン比率/s)、速度(cm/s)を通知します。
public static UnityAction<int, Vector2, Vector2, Vector2> OnDoubleTouchMove;
// タッチ終了通知
// タッチが離されたフィンガーID、位置スクリーンを通知します。
public static UnityAction<int, Vector2> OnTouchUp;
// タッチキャンセル通知
// タッチ移動がキャンセル主に画面外に移動された場合に、フィンガーID、その最終位置スクリーンを通知します。
public static UnityAction<int, Vector2> OnTouchMoveCancel;
// タップ通知
// タップされた時に、フィンガーID、その位置スクリーンを通知します。
public static UnityAction<int, Vector2> OnTouchTap;
// フリック通知
// フリック判定された場合に、フィンガーID、その位置スクリーン、フリック速度(スクリーン比率/s)、速度(cm/s)を通知します。
public static UnityAction<int, Vector2, Vector2, Vector2> OnTouchFlick;
// ピンチイン/アウト通知
// ピンチイン/アウトの速度(スクリーン比率/s、速度(cm/s)を通知します。
public static UnityAction<float, float> OnTouchPinch;
// バックボタン通知Androiddeでは戻るボタン、PCでは BackSpace ボタン)
public static UnityAction OnBackButton;
//=========================================================================================
/// <summary>
/// Reload Domain 対策
/// </summary>
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void Init()
{
InitMember();
}
//=========================================================================================
protected override void InitSingleton()
{
// スクリーン情報
CalcScreenDpi();
// 情報初期化
downPos = new Vector2[MaxFinger];
lastPos = new Vector2[MaxFinger];
flickDownPos = new Vector2[MaxFinger];
flickDownTime = new float[MaxFinger];
// マウス用
mouseDown = new bool[3];
mouseOldMovePos = new Vector2[3];
AllResetTouchInfo();
// モバイルプラットフォーム判定
mobilePlatform = Application.isMobilePlatform;
}
void Update()
{
// 入力タイプ別更新処理
if (mobilePlatform)
{
// モバイル用タッチ入力
UpdateMobile();
}
else
{
// マウスエミュレーション
UpdateMouse();
}
}
//=========================================================================================
/// <summary>
/// スクリーンのDPI値(Dots per inchi)1インチ当たりのピクセル数を取得する
/// </summary>
public static float ScreenDpi
{
get
{
return Instance.screenDpi;
}
}
/// <summary>
/// スクリーンのDPC値(Dots per cm)1cm当たりのピクセル数を取得する
/// </summary>
public static float ScreenDpc
{
get
{
return Instance.screenDpc;
}
}
/// <summary>
/// スクリーンDpi/Dpcの再計算
/// </summary>
private void CalcScreenDpi()
{
screenDpi = Screen.dpi;
if (screenDpi == 0.0f)
{
screenDpi = 96; // ダミー
}
screenDpc = screenDpi / 2.54f; // インチをcmに変換
}
// タッチ入力情報リセット
private void AllResetTouchInfo()
{
mainFingerId = -1;
subFingerId = -1;
for (int i = 0; i < 3; i++)
{
mouseDown[i] = false;
}
}
public int GetTouchCount()
{
return Input.touchCount;
}
public bool IsUI()
{
if (EventSystem.current == null)
return false;
if (mobilePlatform)
{
// モバイル用タッチ入力
return EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId);
}
else
{
// マウスエミュレーション
return EventSystem.current.IsPointerOverGameObject();
}
}
//=========================================================================================
/// <summary>
/// モバイル用入力更新
/// </summary>
private void UpdateMobile()
{
int count = Input.touchCount;
if (count == 0)
{
AllResetTouchInfo();
// バックボタン
if (Application.platform == RuntimePlatform.Android)
{
if (Input.GetKey(KeyCode.Escape) && lastTime + 0.2f < Time.time)
{
lastTime = Time.time;
if (OnBackButton != null)
{
OnBackButton();
}
return;
}
}
}
else
{
// メイン
for (int i = 0; i < count; i++)
{
Touch touch = Input.GetTouch(i);
int fid = touch.fingerId;
// フィンガーIDが以外は無視する
if (fid >= 2)
{
continue;
}
if (touch.phase == TouchPhase.Began)
{
if (IsUI())
continue;
// down pos
downPos[fid] = touch.position;
lastPos[fid] = touch.position;
flickDownPos[fid] = touch.position;
if (fid == 0)
{
mainFingerId = fid;
}
else
{
subFingerId = fid;
}
// Downはメインフィンガーのみ
if (fid == 0)
{
flickDownTime[fid] = Time.time;
if (OnTouchDown != null)
{
OnTouchDown(fid, touch.position);
}
}
}
else if (touch.phase == TouchPhase.Moved)
{
// ピンチイン/アウト判定
if (mainFingerId >= 0 && subFingerId >= 0)
{
Vector2 t1pos = Vector2.zero;
Vector2 t2pos = Vector2.zero;
Vector2 t1delta = Vector2.zero;
Vector2 t2delta = Vector2.zero;
int setcnt = 0;
for (int j = 0; j < count; j++)
{
Touch t = Input.GetTouch(j);
if (mainFingerId == t.fingerId)
{
t1pos = t.position;
t1delta = t.deltaPosition;
setcnt++;
}
else if (subFingerId == t.fingerId)
{
t2pos = t.position;
t2delta = t.deltaPosition;
setcnt++;
}
}
if (setcnt == 2)
{
float nowdist = Vector2.Distance(t1pos, t2pos);
float olddist = Vector2.Distance(t1pos - t1delta, t2pos - t2delta);
float dist = nowdist - olddist;
// cm/sに変換
float distcm = dist / screenDpc; // 移動量(cm)
float speedcm = distcm / Time.deltaTime; // 速度(cm/s)
// スクリーン比率の速度
float speedscr = (dist / (Screen.width + Screen.height) * 0.5f) / Time.deltaTime;
// ピンチ通知(移動量(cm), 速度(cm/s))
if (OnTouchPinch != null)
{
OnTouchPinch(speedscr, speedcm);
}
}
if (fid == 0)
{
Vector2 distVec2 = touch.position - lastPos[fid];
Vector2 distcm = distVec2 / screenDpc; // 移動量(cm)
Vector2 speedcm = distcm / Time.deltaTime; // 速度(cm/s)
// 速度(スクリーン比率)
Vector2 speedscr = CalcScreenRatioVector(distVec2) / Time.deltaTime;
// 移動通知(現在スクリーン座標、速度(スクリーン比率), 速度(cm/s))
if (OnDoubleTouchMove != null)
{
OnDoubleTouchMove(fid, touch.position, speedscr, speedcm);
}
lastPos[fid] = touch.position;
}
}
else
{
// Moveはメインフィンガーのみ
if (fid == 0 && mainFingerId >= 0)
{
Vector2 distVec2 = touch.position - lastPos[fid];
Vector2 distcm = distVec2 / screenDpc; // 移動量(cm)
Vector2 speedcm = distcm / Time.deltaTime; // 速度(cm/s)
// 速度(スクリーン比率)
Vector2 speedscr = CalcScreenRatioVector(distVec2) / Time.deltaTime;
// 移動通知(現在スクリーン座標、速度(スクリーン比率), 速度(cm/s))
if (OnTouchMove != null)
{
OnTouchMove(fid, touch.position, speedscr, speedcm);
}
// フリックダウン位置更新
flickDownPos[fid] = (flickDownPos[fid] + touch.position) * 0.5f;
flickDownTime[fid] = Time.time;
}
lastPos[fid] = touch.position;
}
}
else if (touch.phase == TouchPhase.Ended)
{
// フィンガーIDのリリース
if (fid == 0)
{
mainFingerId = -1;
subFingerId = -1;
}
else
{
subFingerId = -1;
}
// End, Tap はメインフィンガーのみ
if (fid == 0)
{
// タップ判定
float dist = Vector2.Distance(downPos[fid], touch.position);
float distcm = dist / screenDpc;
if (distcm <= tapRadiusCm)
{
// タップ通知
if (OnTouchTap != null)
{
OnTouchTap(fid, touch.position);
}
}
// フリック判定
else
{
CheckFlic(fid, downPos[fid], touch.position, flickDownPos[fid], flickDownTime[fid]);
}
// タップアップ通知
if (OnTouchUp != null)
{
OnTouchUp(fid, touch.position);
}
}
}
else if (touch.phase == TouchPhase.Canceled)
{
// フィンガーIDのリリース
if (fid == 0)
{
mainFingerId = -1;
subFingerId = -1;
}
else
{
subFingerId = -1;
}
// Cancelはメインフィンガーのみ
if (fid == 0)
{
if (OnTouchMoveCancel != null)
{
OnTouchMoveCancel(fid, touch.position);
}
}
}
}
}
}
/// <summary>
/// スクリーン比率に変換したベクトルを求める
/// </summary>
/// <param name="vec"></param>
/// <returns></returns>
private Vector2 CalcScreenRatioVector(Vector2 vec)
{
return new Vector2(vec.x / Screen.width, vec.y / Screen.height);
}
/// <summary>
/// フリック判定
/// </summary>
/// <param name="oldpos"></param>
/// <param name="nowpos"></param>
/// <param name="downpos"></param>
/// <param name="flicktime"></param>
/// <returns></returns>
private bool CheckFlic(int fid, Vector2 oldpos, Vector2 nowpos, Vector2 downpos, float flicktime)
{
// フリック判定
float dist = Vector2.Distance(nowpos, downpos);
float distcm = dist / screenDpc;
if (distcm > flickRangeCm)
{
{
// 移動ピクセルをcm変換し、速度cm/sを割り出す
Vector2 distVec = (nowpos - downpos);
Vector2 distVec2 = distVec / screenDpc; // cmへ変換(移動量(cm))
float timeInterval = Time.time - flicktime;
float speedX = distVec2.x / timeInterval; // 速度(cm/s)
float speedY = distVec2.y / timeInterval; // 速度(cm/s)
//Develop.Log("distVec", distVec * 100);
//Develop.Log("sppedX:", speedX, " speedY:", speedY);
if (Mathf.Abs(speedX) >= flickCheckSpeed || Mathf.Abs(speedY) >= flickCheckSpeed)
{
// フリック通知(スクリーン位置,速度(スクリーン比率/s,速度(cm/s))
if (OnTouchFlick != null)
{
OnTouchFlick(fid, nowpos, CalcScreenRatioVector(distVec) / timeInterval, new Vector2(speedX, speedY));
}
return true;
}
}
}
return false;
}
//=========================================================================================
/// <summary>
/// 入力情報更新PC用
/// マウスエミュレーション
/// ・右クリックは使わない。
/// ・ピンチイン/アウトはマウスホイール。
/// </summary>
private void UpdateMouse()
{
// BackSpace を Android 端末のバックボタンに割り当てる
if (Input.GetKeyDown(KeyCode.Backspace))
{
if (OnBackButton != null)
OnBackButton();
return;
}
for (int i = 0; i < 3; i++)
{
// マウスボタンダウン
if (Input.GetMouseButtonDown(i))
{
if (IsUI())
continue;
if (mouseDown[i] == false && i == 0)
{
flickDownTime[i] = Time.time;
}
mouseDown[i] = true;
// 入力位置を記録
downPos[i] = Input.mousePosition;
mouseOldMovePos[i] = Input.mousePosition;
if (i == 0)
flickDownPos[i] = Input.mousePosition;
// タッチダウンイベント発行
if (OnTouchDown != null)
OnTouchDown(i, Input.mousePosition);
}
// マウスボタンアップ
if (Input.GetMouseButtonUp(i) && mouseDown[i])
{
mouseDown[i] = false;
// フリック判定
if (i == 0)
{
CheckFlic(i, mouseOldMovePos[i], Input.mousePosition, flickDownPos[i], flickDownTime[i]);
}
mouseOldMovePos[i] = Vector2.zero;
// タッチアップイベント
if (OnTouchUp != null)
OnTouchUp(i, Input.mousePosition);
// タップ判定
float distcm = Vector2.Distance(downPos[0], Input.mousePosition) / screenDpc;
if (distcm <= tapRadiusCm)
{
if (OnTouchTap != null)
OnTouchTap(i, Input.mousePosition);
}
}
// 移動
if (mouseDown[i])
{
Vector2 spos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
Vector2 delta = spos - mouseOldMovePos[i];
if (spos != mouseOldMovePos[i])
{
// 速度
Vector3 deltacm = delta / screenDpc; // 移動量(cm)
Vector2 speedcm = deltacm / Time.deltaTime; // 速度(cm/s)
// 移動通知(現在スクリーン座標、速度(スクリーン比率/s)、速度(cm/s))
if (OnTouchMove != null)
OnTouchMove(i, Input.mousePosition, CalcScreenRatioVector(delta) / Time.deltaTime, speedcm);
}
mouseOldMovePos[i] = Input.mousePosition;
// フリックダウン位置更新
flickDownPos[i] = (flickDownPos[i] + spos) * 0.5f;
flickDownTime[i] = Time.time;
}
}
// ピンチイン/アウト
float w = Input.GetAxis("Mouse ScrollWheel");
if (Mathf.Abs(w) > 0.01f)
{
// モバイル入力とスケール感を合わせるために係数を掛ける
w *= mouseWheelSpeed;
float speedcm = w / Time.deltaTime;
float speedscr = (w / (Screen.width + Screen.height) * 0.5f) / Time.deltaTime;
// 通知(速度(スクリーン比率/s)、速度(cm/s)
if (OnTouchPinch != null)
OnTouchPinch(speedscr, speedcm);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 08208c43232950a4f8b6eae1f7919c13
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using UnityEngine;
using UnityEngine.UI;
namespace MagicaCloth2
{
public class SliderText : MonoBehaviour
{
[SerializeField]
private Text text = null;
[SerializeField]
private string lable = "";
[SerializeField]
private string format = "0.00";
private string formatString;
void Start()
{
formatString = "{0} ({1:" + format + "})";
var slider = GetComponent<Slider>();
if (slider)
{
slider.onValueChanged.AddListener(OnChangeValue);
var val = slider.value;
slider.value = 0.001f;
slider.value = val;
}
}
private void OnChangeValue(float value)
{
if (text)
{
text.text = string.Format(formatString, lable, value);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 37e7fecf2cf6fff42800da6e57c20d5d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using UnityEngine;
namespace MagicaCloth2
{
public class TargetFPS : MonoBehaviour
{
public int frameRate = 60;
void Start()
{
#if !UNITY_EDITOR
Application.targetFrameRate = frameRate;
#endif
}
// Update is called once per frame
void Update()
{
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 70abefeafa131dd428880b40bd4c183c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,99 @@
// Magica Cloth 2.
// Copyright (c) 2023 MagicaSoft.
// https://magicasoft.jp
using System.Collections.Generic;
using UnityEngine;
namespace MagicaCloth2
{
public class WindDemo : MonoBehaviour
{
[SerializeField]
private MagicaWindZone magicaWindZone;
[SerializeField]
private WindZone unityWindZone;
[SerializeField]
private Renderer arrowRenderer = null;
[SerializeField]
private Gradient arrowGradient = new Gradient();
[SerializeField]
private List<Transform> rotationTransforms = new List<Transform>();
private float angleY = 0.0f;
private float angleX = 0.0f;
private float main = 0.0f;
private float turbulence = 0.0f;
void Start()
{
}
public void OnDirectionY(float value)
{
angleY = value;
UpdateDirection();
}
public void OnDirectionX(float value)
{
angleX = value;
UpdateDirection();
}
public void OnMain(float value)
{
main = value;
UpdateMagicaWindZone();
UpdateUnityWindZone();
UpdateArrowColor();
}
public void OnTurbulence(float value)
{
turbulence = value;
UpdateMagicaWindZone();
}
//=========================================================================================
void UpdateArrowColor()
{
if (arrowRenderer)
{
// color
var t = Mathf.Clamp01(Mathf.InverseLerp(0.0f, 20.0f, main));
var col = arrowGradient.Evaluate(t);
arrowRenderer.material.color = col * 0.7f;
}
}
void UpdateDirection()
{
var lrot = Quaternion.Euler(angleX, angleY, 0.0f);
foreach (var t in rotationTransforms)
if (t)
t.localRotation = lrot;
UpdateMagicaWindZone();
}
void UpdateMagicaWindZone()
{
if (magicaWindZone)
{
magicaWindZone.main = main;
magicaWindZone.turbulence = turbulence;
magicaWindZone.directionAngleX = angleX;
magicaWindZone.directionAngleY = angleY;
}
}
void UpdateUnityWindZone()
{
if (unityWindZone)
{
unityWindZone.windMain = main;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 13f11cb1bd01c684b9a48fd075e6a541
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 399b9b712612aee4895e5d0c4dd98d3d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b969454d26657854a8fe82c813fb0876
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e0b73429f84a56840ba17b216237f806
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2233c08f69efaa348b41487c7aece386
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: 00d6a209303f1804a81aee79794da3a4
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 0
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ec893c380aa139943a8cb29f3a934540
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 34a0a79e78943c44b8e0dbdbb3f7ab58
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 93948452698a73449bbea353e91d29c7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f270683cd8624d64d8d14af230cc8463
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More