Optimize physical collisions
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1102 &-6990203995391153023
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: test
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: e9146c1290a6ccb42b6a8c21281aaa23, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1107 &-6907050837732902023
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: -6990203995391153023}
|
||||
m_Position: {x: 200, y: 0, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
m_StateMachineTransitions: {}
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: -6990203995391153023}
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: box
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters: []
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: -6907050837732902023}
|
||||
m_Mask: {fileID: 0}
|
||||
m_Motions: []
|
||||
m_Behaviours: []
|
||||
m_BlendingMode: 0
|
||||
m_SyncedLayerIndex: -1
|
||||
m_DefaultWeight: 0
|
||||
m_IKPass: 0
|
||||
m_SyncedLayerAffectsTiming: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85b0a681167756e42a76e8acd9a31072
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 9100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,205 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: test
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: {x: 0, y: -0.99102783, z: 0}
|
||||
inSlope: {x: 0, y: 18.532507, z: 0}
|
||||
outSlope: {x: 0, y: 18.532507, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.06983637, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 0.06666667
|
||||
value: {x: 0, y: 0.20852092, z: 0}
|
||||
inSlope: {x: 0, y: Infinity, z: 0}
|
||||
outSlope: {x: 0, y: Infinity, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 3
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 0.16666667
|
||||
value: {x: 0, y: 1, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: {x: 0, y: 1, z: 0}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path:
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 0
|
||||
attribute: 1
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 1
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 1
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -0.99102783
|
||||
inSlope: 18.532507
|
||||
outSlope: 18.532507
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.06983637
|
||||
- serializedVersion: 3
|
||||
time: 0.06666667
|
||||
value: 0.20852092
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 1
|
||||
weightedMode: 3
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.16666667
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 1
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 1
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9146c1290a6ccb42b6a8c21281aaa23
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -124,11 +124,11 @@ public class CameraOrbit : MonoBehaviour
|
||||
Camera.main.fieldOfView = OrbitCamFovSlider.value;
|
||||
Vector3 position = transform.position;
|
||||
|
||||
if (Input.GetMouseButtonDown(2) && !eventSystem.IsPointerOverGameObject())
|
||||
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
|
||||
{
|
||||
controlOn = true;
|
||||
}
|
||||
if (Input.GetMouseButton(2) && controlOn)
|
||||
if (Input.GetMouseButton(0) && controlOn)
|
||||
{
|
||||
position -= Input.GetAxis("Mouse X") * transform.right * OrbitCamSpeedSlider.value;
|
||||
OrbitCamZoomSlider.value -= Input.mouseScrollDelta.y * OrbitCamZoomSpeedSlider.value;
|
||||
|
||||
@@ -6,7 +6,6 @@ public class UIElementDragger : EventTrigger
|
||||
private bool dragging;
|
||||
public Transform alsoDrag;
|
||||
public Vector3 alsoDragOffset = Vector3.zero;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
alsoDrag = transform.parent.GetChild(0);
|
||||
|
||||
@@ -233,6 +233,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
|
||||
|
||||
LoadAsset(UmaViewerMain.Instance.AbList.FirstOrDefault(a => a.Name.EndsWith($"anm_eve_chr{id}_00_idle01_loop")));
|
||||
}
|
||||
|
||||
private void LoadMiniUma(int id, string costumeId)
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Gallop
|
||||
{
|
||||
List<Transform> gameObjects = new List<Transform>();
|
||||
Dictionary<string, DynamicBoneColliderBase> DynamicBoneColliders = new Dictionary<string, DynamicBoneColliderBase>();
|
||||
gameObjects.AddRange(transform.parent.GetComponentsInChildren<Transform>());
|
||||
gameObjects.AddRange(transform.parent.transform.parent.GetComponentsInChildren<Transform>());
|
||||
foreach (CySpringCollisionData collider in collisionParam)
|
||||
{
|
||||
if (collider._isInner) continue;
|
||||
@@ -80,29 +80,33 @@ namespace Gallop
|
||||
{
|
||||
var dynamic = bone.gameObject.AddComponent<DynamicBone>();
|
||||
dynamic.m_Root = bone;
|
||||
dynamic.m_Gravity = new Vector3(0, -spring._gravity/70000, 0);
|
||||
dynamic.m_Stiffness = spring._stiffnessForce/7000;
|
||||
dynamic.m_UpdateMode = DynamicBone.UpdateMode.Normal;
|
||||
dynamic.SetupParticles();
|
||||
dynamic.m_Gravity = new Vector3(0, -spring._gravity/80000, 0);
|
||||
dynamic.m_Stiffness = spring._stiffnessForce/8000;
|
||||
dynamic.m_Elasticity = spring._dragForce/9000;
|
||||
dynamic.m_Radius = spring._collisionRadius;
|
||||
dynamic.m_Colliders = new List<DynamicBoneColliderBase>();
|
||||
foreach (string collisionName in spring._collisionNameList)
|
||||
{
|
||||
if(DynamicBoneColliders.TryGetValue(collisionName,out DynamicBoneColliderBase val))
|
||||
if (DynamicBoneColliders.TryGetValue(collisionName,out DynamicBoneColliderBase val))
|
||||
{
|
||||
if (!dynamic.m_Colliders.Contains(val))
|
||||
dynamic.m_Colliders.Add(val);
|
||||
dynamic.m_Particles[0].m_Colliders.Add(val);
|
||||
}
|
||||
}
|
||||
foreach (CySpringParamDataChildElement Childcollision in spring._childElements)
|
||||
{
|
||||
foreach (string collisionName in Childcollision._collisionNameList)
|
||||
var tempParticle = dynamic.m_Particles.Find(a => { return a.m_Transform.gameObject.name == Childcollision._boneName; });
|
||||
if (tempParticle != null)
|
||||
{
|
||||
if (DynamicBoneColliders.TryGetValue(collisionName, out DynamicBoneColliderBase val))
|
||||
foreach (string collisionName in Childcollision._collisionNameList)
|
||||
{
|
||||
if(!dynamic.m_Colliders.Contains(val))
|
||||
dynamic.m_Colliders.Add(val);
|
||||
if (DynamicBoneColliders.TryGetValue(collisionName, out DynamicBoneColliderBase val))
|
||||
{
|
||||
tempParticle.m_Colliders.Add(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,10 +83,7 @@ public class DynamicBone : MonoBehaviour
|
||||
#endif
|
||||
public Vector3 m_Force = Vector3.zero;
|
||||
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
[Tooltip("Collider objects interact with the bones.")]
|
||||
#endif
|
||||
public List<DynamicBoneColliderBase> m_Colliders = null;
|
||||
|
||||
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
[Tooltip("Bones exclude from physics simulation.")]
|
||||
@@ -109,6 +106,7 @@ public class DynamicBone : MonoBehaviour
|
||||
public bool m_DistantDisable = false;
|
||||
public Transform m_ReferenceObject = null;
|
||||
public float m_DistanceToObject = 20;
|
||||
public List<Particle> m_Particles = new List<Particle>();
|
||||
|
||||
Vector3 m_LocalGravity = Vector3.zero;
|
||||
Vector3 m_ObjectMove = Vector3.zero;
|
||||
@@ -119,8 +117,10 @@ public class DynamicBone : MonoBehaviour
|
||||
float m_Weight = 1.0f;
|
||||
bool m_DistantDisabled = false;
|
||||
|
||||
class Particle
|
||||
|
||||
public class Particle
|
||||
{
|
||||
public List<DynamicBoneColliderBase> m_Colliders = new List<DynamicBoneColliderBase>();
|
||||
public Transform m_Transform = null;
|
||||
public int m_ParentIndex = -1;
|
||||
public float m_Damping = 0;
|
||||
@@ -139,11 +139,11 @@ public class DynamicBone : MonoBehaviour
|
||||
public Quaternion m_InitLocalRotation = Quaternion.identity;
|
||||
}
|
||||
|
||||
List<Particle> m_Particles = new List<Particle>();
|
||||
|
||||
|
||||
void Start()
|
||||
void Awake()
|
||||
{
|
||||
SetupParticles();
|
||||
//SetupParticles();
|
||||
}
|
||||
|
||||
void FixedUpdate()
|
||||
@@ -554,12 +554,12 @@ public class DynamicBone : MonoBehaviour
|
||||
}
|
||||
|
||||
// collide
|
||||
if (m_Colliders != null)
|
||||
if (p.m_Colliders != null)
|
||||
{
|
||||
float particleRadius = p.m_Radius * m_ObjectScale;
|
||||
for (int j = 0; j < m_Colliders.Count; ++j)
|
||||
for (int j = 0; j < p.m_Colliders.Count; ++j)
|
||||
{
|
||||
DynamicBoneColliderBase c = m_Colliders[j];
|
||||
DynamicBoneColliderBase c = p.m_Colliders[j];
|
||||
if (c != null && c.enabled)
|
||||
p.m_isCollide |= c.Collide(ref p.m_Position, particleRadius);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ namespace Gallop
|
||||
MouthMorphs.Add(morph);
|
||||
}
|
||||
}
|
||||
|
||||
MouthMorphs[4].Weight = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user