Commit 52eafd88 authored by wanqing's avatar wanqing

铁球逻辑修改

parent 8a4f80ac
This diff is collapsed.
fileFormatVersion: 2
guid: cf9256dcc0f94a048bdd3fdcfc65537c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -33,9 +33,9 @@ public class SixLevelCollision : MonoBehaviour
//}
}
private void OnCollisionEnter(Collision other)
private void OnTriggerEnter(Collider other)
{
if (other.collider.gameObject.CompareTag("Ball") && m_bCollider)
if (other.gameObject.CompareTag("Ball") && m_bCollider)
{
m_bCollider = false;
m_render.enabled = false;
......
......@@ -6,7 +6,6 @@ using Obi;
public class ChainHandle : MonoBehaviour
{
public ObiSolver m_solver;
public Rigidbody m_steelBallRigidBody;//铁球
public Transform SteelBallTrans => m_steelBallRigidBody.transform;
private RectTransform m_thumbRT;//摇杆
......@@ -18,12 +17,14 @@ public class ChainHandle : MonoBehaviour
private float m_topColliderPosY;//Y位置
private Vector3 m_maxHeightBallPos = new Vector3(2.075f, 3.0f, -6.5f);//铁球最大高度
private Transform m_parentTrans;//父节点
private HingeJoint m_hingJoint;
// Start is called before the first frame update
private void Awake()
{
m_rigidBody = gameObject.GetComponent<Rigidbody>();
m_topColliderPosY = transform.position.y;
m_parentTrans = transform.parent;
m_hingJoint = gameObject.GetComponent<HingeJoint>();
//Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.Legacy;
}
private void OnCollisionEnter(Collision other)
......@@ -207,28 +208,31 @@ public class ChainHandle : MonoBehaviour
{
if (hit.collider.gameObject.CompareTag("Target"))
{
//m_solver.simulateWhenInvisible = false;
//十字架位置
float varX = (Input.mousePosition.x - Screen.width / 2f) / (Screen.width / GlobalConfig.NormalWidth);
float varY = (Input.mousePosition.y - Screen.height / 2f) / (Screen.width / GlobalConfig.NormalWidth);
BattleCtrl.instance.battleUI.SetSymbolPos(varX, varY);
//设置铁球位置
m_steelBallRigidBody.isKinematic = true;
m_steelBallRigidBody.transform.localPosition = m_maxHeightBallPos;
m_steelBallRigidBody.transform.localRotation = Quaternion.identity;
m_rigidBody.isKinematic = true;
if(m_hingJoint)
{
GameObject.Destroy(m_hingJoint);
m_hingJoint = null;
}
transform.localRotation = Quaternion.Euler(60,0,0);
Vector3 varVec3 = m_parentTrans.position;
varVec3.x = hit.point.x - m_maxHeightBallPos.x;
varVec3.y = hit.point.y + 6.5f;
varVec3.y = hit.point.y+6.0f;
m_parentTrans.position = varVec3;
GameServices.timerServices.Push(this, 1, delegate
GameServices.timerServices.Push(this, 0.1f, delegate
{
// if(m_solver)
// {
// m_solver.simulateWhenInvisible = true;
// }
if (m_steelBallRigidBody)
if (!m_hingJoint)
{
m_hingJoint = gameObject.AddComponent<HingeJoint>();
}
if(m_rigidBody)
{
m_steelBallRigidBody.isKinematic = false;
m_rigidBody.isKinematic = false;
}
});
}
......
fileFormatVersion: 2
guid: f164672bcb7897c4fa73b75c10ee6bf1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 76266eba564a24c4daca02f397c20384
ModelImporter:
serializedVersion: 19300
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 1
materialName: 0
materialSearch: 1
materialLocation: 1
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: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
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