Commit 5f1608c0 authored by wanqing's avatar wanqing

优化碰撞

parent 28f02e4a
...@@ -17,6 +17,11 @@ public class TargetCollision : MonoBehaviour ...@@ -17,6 +17,11 @@ public class TargetCollision : MonoBehaviour
m_bControl = false; m_bControl = false;
varView.SetTargetCollison(other.collider.transform, true); varView.SetTargetCollison(other.collider.transform, true);
} }
Rigidbody varBody = GetComponent<Rigidbody>();
if(varBody && varView && varView.IsHitTarget)
{
varBody.velocity = Vector3.zero;
}
} }
} }
private void OnCollisionExit(Collision other) private void OnCollisionExit(Collision other)
......
...@@ -34,6 +34,7 @@ public class StorageView : MonoBehaviour ...@@ -34,6 +34,7 @@ public class StorageView : MonoBehaviour
private float m_bottomHeight = 0.25f;//底部高度 private float m_bottomHeight = 0.25f;//底部高度
private Camera m_camera; private Camera m_camera;
private bool m_bIsHitTarget = false; private bool m_bIsHitTarget = false;
public bool IsHitTarget => m_bIsHitTarget;
private float m_curTargetPosY = 0.0f;//当前抓的目标位置Y private float m_curTargetPosY = 0.0f;//当前抓的目标位置Y
private float m_modelCompassTopPosY = 1.18f;//指南针//0.2 private float m_modelCompassTopPosY = 1.18f;//指南针//0.2
private float m_modelBinocularTopPosY = 1.17f;//望远镜//0.44 private float m_modelBinocularTopPosY = 1.17f;//望远镜//0.44
...@@ -371,9 +372,9 @@ public class StorageView : MonoBehaviour ...@@ -371,9 +372,9 @@ public class StorageView : MonoBehaviour
m_curTargetTrans.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, m_curTargetTrans.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,
Input.mousePosition.y, m_targetScreenVec.z)); Input.mousePosition.y, m_targetScreenVec.z));
//十字架位置 //十字架位置
float varX = (Input.mousePosition.x - Screen.width / 2f) / (Screen.width / GlobalConfig.NormalWidth); //float varX = (Input.mousePosition.x - Screen.width / 2f) / (Screen.width / GlobalConfig.NormalWidth);
float varY = (Input.mousePosition.y - Screen.height / 2f) / (Screen.width / GlobalConfig.NormalWidth); //float varY = (Input.mousePosition.y - Screen.height / 2f) / (Screen.width / GlobalConfig.NormalWidth);
BattleCtrl.instance.battleUI.SetSymbolPos(varX, varY); //BattleCtrl.instance.battleUI.SetSymbolPos(varX, varY);
//if(string.Equals(m_curTargetTrans.name, m_modelBallStr)) //if(string.Equals(m_curTargetTrans.name, m_modelBallStr))
//{ //{
// m_curTargetTrans.transform.localScale = Vector3.Lerp(m_curTargetTrans.transform.localScale, Vector3.one * 4, 0.2f); // m_curTargetTrans.transform.localScale = Vector3.Lerp(m_curTargetTrans.transform.localScale, Vector3.one * 4, 0.2f);
...@@ -439,17 +440,17 @@ public class StorageView : MonoBehaviour ...@@ -439,17 +440,17 @@ public class StorageView : MonoBehaviour
} }
m_curTargetTrans.transform.position = varPos; m_curTargetTrans.transform.position = varPos;
} }
if (m_bIsHitTarget) //if (m_bIsHitTarget)
{ //{
m_bIsHitTarget = false; // m_bIsHitTarget = false;
if (m_animator) // if (m_animator)
{ // {
m_animator.enabled = true; // m_animator.enabled = true;
} // }
Invoke("SetTargetParent", 1.0f); // Invoke("SetTargetParent", 1.0f);
//m_camera.transform.position = Vector3.Lerp(m_camera.transform.position, m_cameraTargetPos, 0.2f); // //m_camera.transform.position = Vector3.Lerp(m_camera.transform.position, m_cameraTargetPos, 0.2f);
//m_camera.transform.rotation = Quaternion.Lerp(m_camera.transform.rotation, m_cameraTargetRotate, 0.2f); // //m_camera.transform.rotation = Quaternion.Lerp(m_camera.transform.rotation, m_cameraTargetRotate, 0.2f);
} //}
if(m_bResult) if(m_bResult)
{ {
for (int i = 0; i < m_targetTrans.Length; i++) for (int i = 0; i < m_targetTrans.Length; i++)
...@@ -499,7 +500,7 @@ public class StorageView : MonoBehaviour ...@@ -499,7 +500,7 @@ public class StorageView : MonoBehaviour
} }
m_collisonTargetTrans = null; m_collisonTargetTrans = null;
m_bIsCollisonTarget = false; m_bIsCollisonTarget = false;
BattleCtrl.instance.battleUI.SetSymbolPos(0, 0); //BattleCtrl.instance.battleUI.SetSymbolPos(0, 0);
//CancelDelayMatChangeHandle(); //CancelDelayMatChangeHandle();
//Invoke("DelayMatChangeHandle", 0.5f); //Invoke("DelayMatChangeHandle", 0.5f);
CancelRotateInvoke(); CancelRotateInvoke();
...@@ -587,8 +588,16 @@ public class StorageView : MonoBehaviour ...@@ -587,8 +588,16 @@ public class StorageView : MonoBehaviour
if (Physics.Raycast(ray, out hit)) if (Physics.Raycast(ray, out hit))
{ {
if (hit.collider && hit.collider.gameObject.CompareTag("Target")) if (hit.collider && hit.collider.gameObject.CompareTag("Target"))
{
if(!m_bIsHitTarget)
{ {
m_bIsHitTarget = true; m_bIsHitTarget = true;
if (m_animator)
{
m_animator.enabled = true;
}
Invoke("SetTargetParent", 1.0f);
}
//for (int i = 0; i < m_targetTrans.Length; i++) //for (int i = 0; i < m_targetTrans.Length; i++)
//{ //{
// m_targetTrans[i].GetComponent<Rigidbody>().isKinematic = true; // m_targetTrans[i].GetComponent<Rigidbody>().isKinematic = true;
......
...@@ -66,15 +66,18 @@ public class GlobalConfig ...@@ -66,15 +66,18 @@ public class GlobalConfig
{ {
int varLevel = BattleCtrl.instance.levelManager.CurLevelIndex; int varLevel = BattleCtrl.instance.levelManager.CurLevelIndex;
float varHeight = 0; float varHeight = 0;
if (varLevel == LevelEnum.levelOneIndex if (varLevel == LevelEnum.levelOneIndex)
|| varLevel == LevelEnum.levelFourIndex || varLevel == LevelEnum.levelFiveIndex {
varHeight = 1.5f;
}
else if (varLevel == LevelEnum.levelFourIndex || varLevel == LevelEnum.levelFiveIndex
|| varLevel == LevelEnum.levelSevenIndex) || varLevel == LevelEnum.levelSevenIndex)
{ {
varHeight = 1.1f; varHeight = 1.1f;
} }
else if (varLevel == LevelEnum.levelTwoIndex || varLevel == LevelEnum.levelThreeIndex) else if (varLevel == LevelEnum.levelTwoIndex || varLevel == LevelEnum.levelThreeIndex)
{ {
varHeight = 1.6f; varHeight = 1.9f;
} }
else if(varLevel == LevelEnum.levelSixIndex) else if(varLevel == LevelEnum.levelSixIndex)
{ {
......
...@@ -311,7 +311,7 @@ Transform: ...@@ -311,7 +311,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 90189418590942544} m_GameObject: {fileID: 90189418590942544}
m_LocalRotation: {x: -0.6593273, y: -0.25551423, z: -0.2555143, w: 0.65932727} m_LocalRotation: {x: -0.6593273, y: -0.25551423, z: -0.2555143, w: 0.65932727}
m_LocalPosition: {x: 0.84, y: -0.33, z: -3.84} m_LocalPosition: {x: 0.84, y: 0.48, z: -3.84}
m_LocalScale: {x: 30, y: 30, z: 30} m_LocalScale: {x: 30, y: 30, z: 30}
m_Children: [] m_Children: []
m_Father: {fileID: 6381050228751430806} m_Father: {fileID: 6381050228751430806}
...@@ -5434,7 +5434,7 @@ Transform: ...@@ -5434,7 +5434,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 975760145897770363} m_GameObject: {fileID: 975760145897770363}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.47, z: -1} m_LocalPosition: {x: 0, y: 1.47, z: -1.77}
m_LocalScale: {x: 2.5, y: 0.01, z: 2.5} m_LocalScale: {x: 2.5, y: 0.01, z: 2.5}
m_Children: [] m_Children: []
m_Father: {fileID: 6686058080312210682} m_Father: {fileID: 6686058080312210682}
...@@ -7369,7 +7369,7 @@ MonoBehaviour: ...@@ -7369,7 +7369,7 @@ MonoBehaviour:
cachedMesh: {fileID: -5597002278806442958, guid: ec6fdbeb5268e694fb33a095e6f252b3, cachedMesh: {fileID: -5597002278806442958, guid: ec6fdbeb5268e694fb33a095e6f252b3,
type: 3} type: 3}
InvisibleUpdate: 0 InvisibleUpdate: 0
readable: 1 readable: 0
--- !u!1 &1875882243473469678 --- !u!1 &1875882243473469678
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -58556,7 +58556,7 @@ MonoBehaviour: ...@@ -58556,7 +58556,7 @@ MonoBehaviour:
cachedMesh: {fileID: 8321685774571456786, guid: ec6fdbeb5268e694fb33a095e6f252b3, cachedMesh: {fileID: 8321685774571456786, guid: ec6fdbeb5268e694fb33a095e6f252b3,
type: 3} type: 3}
InvisibleUpdate: 0 InvisibleUpdate: 0
readable: 1 readable: 0
--- !u!1 &6404169673511446009 --- !u!1 &6404169673511446009
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -63788,7 +63788,7 @@ Transform: ...@@ -63788,7 +63788,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7803985779353112106} m_GameObject: {fileID: 7803985779353112106}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.43, z: -1.02} m_LocalPosition: {x: 0, y: 0.43, z: -1.77}
m_LocalScale: {x: 3, y: 1.5, z: 3} m_LocalScale: {x: 3, y: 1.5, z: 3}
m_Children: [] m_Children: []
m_Father: {fileID: 6686058080312210682} m_Father: {fileID: 6686058080312210682}
...@@ -16932,7 +16932,7 @@ MonoBehaviour: ...@@ -16932,7 +16932,7 @@ MonoBehaviour:
cachedMesh: {fileID: 1044666760486720641, guid: 188a7f6966cec7d44b52b5c344f37345, cachedMesh: {fileID: 1044666760486720641, guid: 188a7f6966cec7d44b52b5c344f37345,
type: 3} type: 3}
InvisibleUpdate: 0 InvisibleUpdate: 0
readable: 1 readable: 0
--- !u!114 &8805164226647202219 --- !u!114 &8805164226647202219
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -41857,7 +41857,7 @@ Transform: ...@@ -41857,7 +41857,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4313810224392433900} m_GameObject: {fileID: 4313810224392433900}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.1, z: 0} m_LocalPosition: {x: 0, y: -0.2, z: 0}
m_LocalScale: {x: 100, y: 1, z: 100} m_LocalScale: {x: 100, y: 1, z: 100}
m_Children: [] m_Children: []
m_Father: {fileID: 8827868373483138479} m_Father: {fileID: 8827868373483138479}
...@@ -92504,7 +92504,7 @@ MonoBehaviour: ...@@ -92504,7 +92504,7 @@ MonoBehaviour:
cachedMesh: {fileID: -7011429734207973542, guid: 188a7f6966cec7d44b52b5c344f37345, cachedMesh: {fileID: -7011429734207973542, guid: 188a7f6966cec7d44b52b5c344f37345,
type: 3} type: 3}
InvisibleUpdate: 0 InvisibleUpdate: 0
readable: 1 readable: 0
--- !u!114 &353385722379460216 --- !u!114 &353385722379460216
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -109630,13 +109630,13 @@ Transform: ...@@ -109630,13 +109630,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8991654502457839963} m_GameObject: {fileID: 8991654502457839963}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0.06975647, y: 0, z: 0, w: 0.9975641}
m_LocalPosition: {x: 0, y: 0.5094759, z: -0.1588525} m_LocalPosition: {x: 0, y: 0.5094759, z: -0.1588525}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 6461549933381941209} m_Father: {fileID: 6461549933381941209}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: -8, y: 0, z: 0}
--- !u!114 &3388061853811875004 --- !u!114 &3388061853811875004
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -114586,7 +114586,7 @@ PrefabInstance: ...@@ -114586,7 +114586,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4226865422111836, guid: 864780f64143e044ba476358cde34b39, type: 3} - target: {fileID: 4226865422111836, guid: 864780f64143e044ba476358cde34b39, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: -0.41 value: 0.12
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4226865422111836, guid: 864780f64143e044ba476358cde34b39, type: 3} - target: {fileID: 4226865422111836, guid: 864780f64143e044ba476358cde34b39, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
...@@ -9875,13 +9875,13 @@ Transform: ...@@ -9875,13 +9875,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1388144024041319108} m_GameObject: {fileID: 1388144024041319108}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0.06975647, y: 0, z: 0, w: 0.9975641}
m_LocalPosition: {x: 0, y: 0.5094759, z: -0.1588525} m_LocalPosition: {x: 0, y: 0.5094759, z: -0.1588525}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 2380451859975094843} m_Father: {fileID: 2380451859975094843}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: -8, y: 0, z: 0}
--- !u!114 &2144170710021341392 --- !u!114 &2144170710021341392
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -30932,7 +30932,7 @@ MonoBehaviour: ...@@ -30932,7 +30932,7 @@ MonoBehaviour:
cachedMesh: {fileID: 1044666760486720641, guid: 188a7f6966cec7d44b52b5c344f37345, cachedMesh: {fileID: 1044666760486720641, guid: 188a7f6966cec7d44b52b5c344f37345,
type: 3} type: 3}
InvisibleUpdate: 0 InvisibleUpdate: 0
readable: 1 readable: 0
--- !u!114 &6174908756435311075 --- !u!114 &6174908756435311075
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -129495,7 +129495,7 @@ MonoBehaviour: ...@@ -129495,7 +129495,7 @@ MonoBehaviour:
cachedMesh: {fileID: -7011429734207973542, guid: 188a7f6966cec7d44b52b5c344f37345, cachedMesh: {fileID: -7011429734207973542, guid: 188a7f6966cec7d44b52b5c344f37345,
type: 3} type: 3}
InvisibleUpdate: 0 InvisibleUpdate: 0
readable: 1 readable: 0
--- !u!114 &7076969204005980210 --- !u!114 &7076969204005980210
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -131875,7 +131875,7 @@ Transform: ...@@ -131875,7 +131875,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6487835245184371423} m_GameObject: {fileID: 6487835245184371423}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.1, z: 0} m_LocalPosition: {x: 0, y: -0.2, z: 0}
m_LocalScale: {x: 100, y: 1, z: 100} m_LocalScale: {x: 100, y: 1, z: 100}
m_Children: [] m_Children: []
m_Father: {fileID: 1969818788198913948} m_Father: {fileID: 1969818788198913948}
...@@ -62329,7 +62329,7 @@ Transform: ...@@ -62329,7 +62329,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3194231658186618696} m_GameObject: {fileID: 3194231658186618696}
m_LocalRotation: {x: -0, y: -0.41915742, z: -0, w: 0.9079136} m_LocalRotation: {x: -0, y: -0.41915742, z: -0, w: 0.9079136}
m_LocalPosition: {x: 0.102, y: -0.624, z: -4.29} m_LocalPosition: {x: 0.102, y: -0.025, z: -4.29}
m_LocalScale: {x: 8, y: 8, z: 8} m_LocalScale: {x: 8, y: 8, z: 8}
m_Children: m_Children:
- {fileID: 3194231658186451818} - {fileID: 3194231658186451818}
...@@ -76278,7 +76278,7 @@ Transform: ...@@ -76278,7 +76278,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5028890651224010748} m_GameObject: {fileID: 5028890651224010748}
m_LocalRotation: {x: -0.075730644, y: 0.98048186, z: -0.013972448, w: 0.18090075} m_LocalRotation: {x: -0.075730644, y: 0.98048186, z: -0.013972448, w: 0.18090075}
m_LocalPosition: {x: 1.2, y: -0.13, z: -3.3799996} m_LocalPosition: {x: 1.2, y: 0.02, z: -3.3799996}
m_LocalScale: {x: 8.5, y: 8.5, z: 8.5} m_LocalScale: {x: 8.5, y: 8.5, z: 8.5}
m_Children: [] m_Children: []
m_Father: {fileID: 7917013256073000625} m_Father: {fileID: 7917013256073000625}
...@@ -119318,7 +119318,7 @@ PrefabInstance: ...@@ -119318,7 +119318,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 49bd86e2cfdb81d458813d8609a06235, type: 3} - target: {fileID: 400000, guid: 49bd86e2cfdb81d458813d8609a06235, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: -0.25 value: 0.226
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 49bd86e2cfdb81d458813d8609a06235, type: 3} - target: {fileID: 400000, guid: 49bd86e2cfdb81d458813d8609a06235, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
...@@ -119500,7 +119500,7 @@ PrefabInstance: ...@@ -119500,7 +119500,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 2d6d15b5004c7974f9d93c34e2469371, type: 3} - target: {fileID: 400000, guid: 2d6d15b5004c7974f9d93c34e2469371, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: -0.57 value: 0.28
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 2d6d15b5004c7974f9d93c34e2469371, type: 3} - target: {fileID: 400000, guid: 2d6d15b5004c7974f9d93c34e2469371, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment