diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs deleted file mode 100644 index e2a3204f9..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs +++ /dev/null @@ -1,41 +0,0 @@ -namespace RotateParticle -{ - [System.Flags] - public enum CollisionGroupMask : uint - { - None = 0, - Group01 = 0x00000001, - Group02 = 0x00000002, - Group03 = 0x00000004, - Group04 = 0x00000008, - Group05 = 0x00000010, - Group06 = 0x00000020, - Group07 = 0x00000040, - Group08 = 0x00000080, - Group09 = 0x00000100, - Group10 = 0x00000200, - Group11 = 0x00000400, - Group12 = 0x00000800, - Group13 = 0x00001000, - Group14 = 0x00002000, - Group15 = 0x00004000, - Group16 = 0x00008000, - Group17 = 0x00010000, - Group18 = 0x00020000, - Group19 = 0x00040000, - Group20 = 0x00080000, - Group21 = 0x00100000, - Group22 = 0x00200000, - Group23 = 0x00400000, - Group24 = 0x00800000, - Group25 = 0x01000000, - Group26 = 0x02000000, - Group27 = 0x04000000, - Group28 = 0x08000000, - Group29 = 0x10000000, - Group30 = 0x20000000, - Group31 = 0x40000000, - Group32 = 0x80000000, - All = uint.MaxValue, - } -} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta deleted file mode 100644 index 8672185ef..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7ac7f1d83935aa84b9e80739be4ae02b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs index 48c2f897b..c83704dc9 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs @@ -27,9 +27,7 @@ namespace RotateParticle // TODO: force / mass => accelaration public float Mass; - public CollisionGroupMask CollisionMask; - - public ParticleInitState(int index, Transform t, float radius, float mass, CollisionGroupMask collisionMask) + public ParticleInitState(int index, Transform t, float radius, float mass) { Index = index; LocalPosition = t.localPosition; @@ -38,7 +36,6 @@ namespace RotateParticle BoneAxis = LocalPosition.normalized; Radius = radius; Mass = mass; - CollisionMask = collisionMask; } public override string ToString() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs deleted file mode 100644 index 0b235f0c2..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Unity.Collections; -using Unity.Jobs; -using UnityEngine; - -namespace RotateParticle -{ - public struct ParticleJob : IJob - { - public float DeltaTime; - public float Stiffness; - public float DragForce; - public Vector3 External; - - public int Index; - public int ParentIndex; - - public float Mass; - public Vector3 Rest; - public Vector3 CurrentPosition; - public Vector3 Prev; - - public Quaternion ParentParentRotation; - public Quaternion InitParentLocalRotation; - public Vector3 InitBoneAxis; - public Vector3 ParentPosition; - - public NativeArray NewPos; - public NativeArray NewRot; - - public void Execute() - { - var tr = Step(); - if (tr.HasValue) - { - var (newPos, parentRot) = tr.Value; - NewPos[Index] = newPos; - NewRot[ParentIndex] = parentRot; - } - } - - public (Vector3 NewPos, Quaternion ParentRotation)? Step() - { - if (Mass == 0) - { - return default; - } - - var sqDt = DeltaTime * DeltaTime; - - var f = (Rest - CurrentPosition) * Stiffness / sqDt; - // Debug.Log($"{rest}"); - - f += (External / sqDt); - - var newPos = CurrentPosition + (CurrentPosition - Prev) * (1 - DragForce) + f * sqDt; - - var parentRotation = CalcParentRotation(newPos, ParentParentRotation, InitParentLocalRotation, InitBoneAxis, ParentPosition); - - return (newPos, parentRotation); - } - - public static Quaternion CalcParentRotation(in Vector3 newPos, - in Quaternion parentparent, - in Quaternion initParentLocalRotation, - in Vector3 initBoneAxis, - in Vector3 parentPosition) - { - // 親の回転として結果を適用する(位置から回転を作る) - var restRotation = parentparent * initParentLocalRotation; - var r = CalcRotation(restRotation, initBoneAxis, newPos - parentPosition); - // _runtime = new ParticleRuntimeState(_runtime.CurrentPosition, transform.position); - return r; - } - - static Quaternion CalcRotation(Quaternion restRotation, Vector3 boneAxis, Vector3 to) - { - Quaternion aimRotation = Quaternion.FromToRotation(restRotation * boneAxis, to); - return aimRotation * restRotation; - } - } -} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta deleted file mode 100644 index 08d8ff997..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7127f077eba307343a5f5ce15213a595 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs index dcf4f91d6..ca09d8c57 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs @@ -12,19 +12,19 @@ namespace RotateParticle public List _particles = new(); public List _particleTransforms = new(); - public Strand MakeParticleStrand(SimulationEnv env, Warp warp, CollisionGroupMask mask) + public Strand MakeParticleStrand(SimulationEnv env, Warp warp) { - var strand = new Strand(mask); + var strand = new Strand(); // root kinematic - var particle_index = _MakeAParticle(null, env, warp.transform, 0, 0, strand.CollisionMask); + var particle_index = _MakeAParticle(null, env, warp.transform, 0, 0); var joint = _particles[particle_index]; strand.Particles.Add(joint); foreach (var particle in warp.Particles) { var child_index = _MakeAParticle(joint, env, particle.Transform, - particle.GetSettings(warp.BaseSettings).HitRadius, 1, strand.CollisionMask); + particle.GetSettings(warp.BaseSettings).HitRadius, 1); var child = _particles[child_index]; strand.Particles.Add(child); joint.Children.Add(child); @@ -34,11 +34,11 @@ namespace RotateParticle return strand; } - int _MakeAParticle(RotateParticle parent, SimulationEnv env, Transform t, float radius, float mass, CollisionGroupMask collisionMask) + int _MakeAParticle(RotateParticle parent, SimulationEnv env, Transform t, float radius, float mass) { var index = _particles.Count; _particleTransforms.Add(t); - _particles.Add(new RotateParticle(index, parent, env, t, radius, mass, collisionMask)); + _particles.Add(new RotateParticle(index, parent, env, t, radius, mass)); return index; } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs index b6ddbb481..ae6d21431 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs @@ -21,9 +21,9 @@ namespace RotateParticle // 直前で接触があった public bool HasCollide = false; - public RotateParticle(int index, RotateParticle parent, SimulationEnv env, Transform transform, float radius, float mass, CollisionGroupMask collisionMask) + public RotateParticle(int index, RotateParticle parent, SimulationEnv env, Transform transform, float radius, float mass) { - Init = new ParticleInitState(index, transform, radius, mass, collisionMask); + Init = new ParticleInitState(index, transform, radius, mass); State = new ParticleRuntimeState(env, transform); Parent = parent; } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index f9626949e..0999150dc 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -143,7 +143,7 @@ namespace RotateParticle foreach (var warp in warps) { var strands = new List(); - var strand = _list.MakeParticleStrand(Env, warp, default); + var strand = _list.MakeParticleStrand(Env, warp); strands.Add(strand); _strands.AddRange(strands); strandMap.Add(warp, strand); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs index a36b1178b..8ba2d991b 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs @@ -6,11 +6,8 @@ namespace RotateParticle { public class Strand { - public CollisionGroupMask CollisionMask; - - public Strand(CollisionGroupMask mask) + public Strand() { - CollisionMask = mask; } public readonly List Particles = new();