From d2d75ad9a6e712a4837065bd98f2a3ba62650379 Mon Sep 17 00:00:00 2001 From: nothke Date: Mon, 19 Aug 2024 23:01:26 +0200 Subject: [PATCH 1/3] Sliding crane with height --- Assets/Prefabs/sliding_crane.prefab | 398 ++++++++++++++++++++-------- Assets/Scripts/CranePickDrop.cs | 6 +- Assets/Scripts/SlidingCrane.cs | 39 ++- 3 files changed, 324 insertions(+), 119 deletions(-) diff --git a/Assets/Prefabs/sliding_crane.prefab b/Assets/Prefabs/sliding_crane.prefab index 8aad606..de44576 100644 --- a/Assets/Prefabs/sliding_crane.prefab +++ b/Assets/Prefabs/sliding_crane.prefab @@ -39,6 +39,37 @@ Transform: - {fileID: 5588713622983561734} m_Father: {fileID: 8361960510235702639} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1806010716434710824 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2647970598110512206} + m_Layer: 0 + m_Name: cable_anchor_3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2647970598110512206 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1806010716434710824} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.953, y: -0.038000584, z: -0.551} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 5974025308748047927} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1974299406274323846 GameObject: m_ObjectHideFlags: 0 @@ -136,6 +167,37 @@ MonoBehaviour: m_BoolArgument: 0 m_CallState: 2 triggeredCollider: {fileID: 0} +--- !u!1 &3147082551467076929 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1586367676327651367} + m_Layer: 0 + m_Name: cable_anchor_4 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1586367676327651367 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3147082551467076929} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.9864149, y: -0.038, z: 0.4822452} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 5974025308748047927} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &4060506572131258815 GameObject: m_ObjectHideFlags: 0 @@ -168,7 +230,6 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 3986187515445640859} - {fileID: 7611546785051987167} - {fileID: 515232485336291104} - {fileID: 5508812383979352818} @@ -205,12 +266,23 @@ MonoBehaviour: velocity: 0 accel: 0 braking: 0 + heightMotion: + maxSpeed: 1 + acceleration: 1 + brakingAcceleration: 0 + progress: 0 + velocity: 0 + accel: 0 + braking: 0 xTransform: {fileID: 5974025308748047927} yTransform: {fileID: 515232485336291104} yRange: 40 xRange: 4.5 - testTgt: {fileID: 0} - target: {x: 0, y: 0, z: 0} + heightRange: 10 + heightMax: -0.7 + heightMin: -8.5 + targetTransform: {fileID: 0} + targetPoint: {x: 0, y: 0, z: 0} cradleTransform: {fileID: 6812918532662551388} cradleRb: {fileID: 649759971140379373} --- !u!114 &5328903551856804412 @@ -476,6 +548,37 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: anchor: {fileID: 383269914609912413} +--- !u!1 &5732044480822511956 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8224441546071051314} + m_Layer: 0 + m_Name: cable_anchor_2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8224441546071051314 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5732044480822511956} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.987, y: -0.038000584, z: 0.482} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 5974025308748047927} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &5860456469555797545 GameObject: m_ObjectHideFlags: 0 @@ -570,6 +673,37 @@ Transform: m_Children: [] m_Father: {fileID: 8361960510235702639} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &6962629087444533983 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6705715073656195001} + m_Layer: 0 + m_Name: cable_anchor_1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6705715073656195001 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6962629087444533983} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.987, y: -0.038000584, z: -0.551} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 5974025308748047927} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &7982327654860529405 GameObject: m_ObjectHideFlags: 0 @@ -1353,19 +1487,19 @@ PrefabInstance: serializedVersion: 2 m_Modification: serializedVersion: 3 - m_TransformParent: {fileID: 5974025308748047927} + m_TransformParent: {fileID: 3986187515445640859} m_Modifications: - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.x - value: 0.9864149 + value: 0.9864151 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.y - value: -6.089389 + value: 0.5168371 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.z - value: 0.4822452 + value: 0.48755348 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.w @@ -1373,15 +1507,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -1397,18 +1531,39 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_Name - value: crane_cradle_cable + value: crane_cradle_cable_4 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} + insertIndex: -1 + addedObject: {fileID: 7651053858026755498} m_SourcePrefab: {fileID: 100100000, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} --- !u!4 &2128323862978452036 stripped Transform: m_CorrespondingSourceObject: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} m_PrefabInstance: {fileID: 5964282468197954033} m_PrefabAsset: {fileID: 0} +--- !u!1 &2316562499630849826 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} + m_PrefabInstance: {fileID: 5964282468197954033} + m_PrefabAsset: {fileID: 0} +--- !u!114 &7651053858026755498 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2316562499630849826} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1cb77b9d79ad78c4d94f551335084d76, type: 3} + m_Name: + m_EditorClassIdentifier: + anchor: {fileID: 1586367676327651367} --- !u!1001 &6056755265446950257 PrefabInstance: m_ObjectHideFlags: 0 @@ -1477,19 +1632,19 @@ PrefabInstance: serializedVersion: 2 m_Modification: serializedVersion: 3 - m_TransformParent: {fileID: 5974025308748047927} + m_TransformParent: {fileID: 3986187515445640859} m_Modifications: - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.x - value: -0.987 + value: -0.98700064 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.y - value: -6.089389 + value: 0.5168371 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.z - value: -0.551 + value: -0.5456923 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.w @@ -1497,15 +1652,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -1521,18 +1676,39 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_Name - value: crane_cradle_cable (2) + value: crane_cradle_cable_1 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} + insertIndex: -1 + addedObject: {fileID: 2015493386465054482} m_SourcePrefab: {fileID: 100100000, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} --- !u!4 &1983621802398535081 stripped Transform: m_CorrespondingSourceObject: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} m_PrefabInstance: {fileID: 6109992222700693020} m_PrefabAsset: {fileID: 0} +--- !u!1 &2749583440394504399 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} + m_PrefabInstance: {fileID: 6109992222700693020} + m_PrefabAsset: {fileID: 0} +--- !u!114 &2015493386465054482 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2749583440394504399} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1cb77b9d79ad78c4d94f551335084d76, type: 3} + m_Name: + m_EditorClassIdentifier: + anchor: {fileID: 6705715073656195001} --- !u!1001 &6197141398173707177 PrefabInstance: m_ObjectHideFlags: 0 @@ -1588,58 +1764,26 @@ PrefabInstance: m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: + - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} + insertIndex: -1 + addedObject: {fileID: 6705715073656195001} + - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} + insertIndex: -1 + addedObject: {fileID: 8224441546071051314} + - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} + insertIndex: -1 + addedObject: {fileID: 2647970598110512206} + - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} + insertIndex: -1 + addedObject: {fileID: 1586367676327651367} + - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} + insertIndex: -1 + addedObject: {fileID: 3986187515445640859} - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} insertIndex: -1 addedObject: {fileID: 6812918532662551388} - - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} - insertIndex: -1 - addedObject: {fileID: 2128323862978452036} - - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} - insertIndex: -1 - addedObject: {fileID: 1546039147292782552} - - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} - insertIndex: -1 - addedObject: {fileID: 1983621802398535081} - - targetCorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} - insertIndex: -1 - addedObject: {fileID: 4539762705889168725} - m_AddedComponents: - - targetCorrespondingSourceObject: {fileID: 4843321515000859519, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} - insertIndex: -1 - addedObject: {fileID: 7425640337567509461} + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} ---- !u!1 &1528483913140330710 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 4843321515000859519, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} - m_PrefabInstance: {fileID: 6197141398173707177} - m_PrefabAsset: {fileID: 0} ---- !u!54 &7425640337567509461 -Rigidbody: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1528483913140330710} - serializedVersion: 4 - m_Mass: 10000 - m_Drag: 0 - m_AngularDrag: 0.05 - m_CenterOfMass: {x: 0, y: 0, z: 0} - m_InertiaTensor: {x: 1, y: 1, z: 1} - m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ImplicitCom: 1 - m_ImplicitTensor: 1 - m_UseGravity: 1 - m_IsKinematic: 1 - m_Interpolate: 0 - m_Constraints: 0 - m_CollisionDetection: 0 --- !u!4 &5974025308748047927 stripped Transform: m_CorrespondingSourceObject: {fileID: 353720696122903966, guid: 6de450877d355da4ea6654f6ce89c7ae, type: 3} @@ -1713,19 +1857,19 @@ PrefabInstance: serializedVersion: 2 m_Modification: serializedVersion: 3 - m_TransformParent: {fileID: 5974025308748047927} + m_TransformParent: {fileID: 3986187515445640859} m_Modifications: - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.x - value: -0.987 + value: -0.9870005 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.y - value: -6.089389 + value: 0.5168371 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.z - value: 0.482 + value: 0.48730868 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.w @@ -1733,15 +1877,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -1757,18 +1901,39 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_Name - value: crane_cradle_cable (1) + value: crane_cradle_cable_2 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} + insertIndex: -1 + addedObject: {fileID: 3271596200498139301} m_SourcePrefab: {fileID: 100100000, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} --- !u!4 &1546039147292782552 stripped Transform: m_CorrespondingSourceObject: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} m_PrefabInstance: {fileID: 6501107008189351021} m_PrefabAsset: {fileID: 0} +--- !u!1 &2944198015370816190 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} + m_PrefabInstance: {fileID: 6501107008189351021} + m_PrefabAsset: {fileID: 0} +--- !u!114 &3271596200498139301 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2944198015370816190} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1cb77b9d79ad78c4d94f551335084d76, type: 3} + m_Name: + m_EditorClassIdentifier: + anchor: {fileID: 8224441546071051314} --- !u!1001 &6508953706269617463 PrefabInstance: m_ObjectHideFlags: 0 @@ -1837,7 +2002,7 @@ PrefabInstance: serializedVersion: 2 m_Modification: serializedVersion: 3 - m_TransformParent: {fileID: 8361960510235702639} + m_TransformParent: {fileID: 5974025308748047927} m_Modifications: - target: {fileID: 4839500568757896197, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} propertyPath: m_Name @@ -1849,11 +2014,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7606757565561977806, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} propertyPath: m_LocalPosition.y - value: 6.4093294 + value: -6.606226 objectReference: {fileID: 0} - target: {fileID: 7606757565561977806, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} propertyPath: m_LocalPosition.z - value: 0.0033111572 + value: -0.005308151 objectReference: {fileID: 0} - target: {fileID: 7606757565561977806, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} propertyPath: m_LocalRotation.w @@ -1889,13 +2054,22 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 7606757565561977806, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} insertIndex: -1 addedObject: {fileID: 383269914609912413} + - targetCorrespondingSourceObject: {fileID: 7606757565561977806, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} + insertIndex: -1 + addedObject: {fileID: 1983621802398535081} + - targetCorrespondingSourceObject: {fileID: 7606757565561977806, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} + insertIndex: -1 + addedObject: {fileID: 1546039147292782552} + - targetCorrespondingSourceObject: {fileID: 7606757565561977806, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} + insertIndex: -1 + addedObject: {fileID: 4539762705889168725} + - targetCorrespondingSourceObject: {fileID: 7606757565561977806, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} + insertIndex: -1 + addedObject: {fileID: 2128323862978452036} m_AddedComponents: - targetCorrespondingSourceObject: {fileID: 4839500568757896197, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} insertIndex: -1 addedObject: {fileID: 649759971140379373} - - targetCorrespondingSourceObject: {fileID: 4839500568757896197, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} - insertIndex: -1 - addedObject: {fileID: 3691808982451206634} m_SourcePrefab: {fileID: 100100000, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} --- !u!1 &2155031763295945040 stripped GameObject: @@ -1925,25 +2099,10 @@ Rigidbody: m_ImplicitCom: 1 m_ImplicitTensor: 1 m_UseGravity: 1 - m_IsKinematic: 0 + m_IsKinematic: 1 m_Interpolate: 1 m_Constraints: 0 m_CollisionDetection: 0 ---- !u!138 &3691808982451206634 -FixedJoint: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2155031763295945040} - m_ConnectedBody: {fileID: 7425640337567509461} - m_ConnectedArticulationBody: {fileID: 0} - m_BreakForce: Infinity - m_BreakTorque: Infinity - m_EnableCollision: 0 - m_EnablePreprocessing: 1 - m_MassScale: 1 - m_ConnectedMassScale: 1 --- !u!4 &3986187515445640859 stripped Transform: m_CorrespondingSourceObject: {fileID: 7606757565561977806, guid: be29f5f73a00b62469d65e6a8ae39e16, type: 3} @@ -2141,19 +2300,19 @@ PrefabInstance: serializedVersion: 2 m_Modification: serializedVersion: 3 - m_TransformParent: {fileID: 5974025308748047927} + m_TransformParent: {fileID: 3986187515445640859} m_Modifications: - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.x - value: 0.953 + value: 0.9530001 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.y - value: -6.089389 + value: 0.5168371 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalPosition.z - value: -0.551 + value: -0.54569167 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.w @@ -2161,15 +2320,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -2185,13 +2344,34 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} propertyPath: m_Name - value: crane_cradle_cable (3) + value: crane_cradle_cable_3 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} + insertIndex: -1 + addedObject: {fileID: 6072988646632812584} m_SourcePrefab: {fileID: 100100000, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} +--- !u!1 &193439519825627187 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8278590419235483347, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} + m_PrefabInstance: {fileID: 8091924167005382368} + m_PrefabAsset: {fileID: 0} +--- !u!114 &6072988646632812584 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 193439519825627187} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1cb77b9d79ad78c4d94f551335084d76, type: 3} + m_Name: + m_EditorClassIdentifier: + anchor: {fileID: 2647970598110512206} --- !u!4 &4539762705889168725 stripped Transform: m_CorrespondingSourceObject: {fileID: 5713994842084092853, guid: b03bc58597e6d004dabd03f71e12b0ad, type: 3} diff --git a/Assets/Scripts/CranePickDrop.cs b/Assets/Scripts/CranePickDrop.cs index d9d9a3a..5ba61c1 100644 --- a/Assets/Scripts/CranePickDrop.cs +++ b/Assets/Scripts/CranePickDrop.cs @@ -37,7 +37,7 @@ public class CranePickDrop : MonoBehaviour if (otherRb && otherRb.isKinematic == false && state == State.Idle) { handlingBody = otherRb; - crane.testTgt = handlingBody.transform; + crane.targetTransform = handlingBody.transform; state = State.Catching; } } @@ -71,7 +71,7 @@ public class CranePickDrop : MonoBehaviour if (magnet.IsCloseTo(handlingBody, 2f)) { - crane.testTgt = null; + crane.targetTransform = null; state = State.WaitingToCatch; timer = 3; @@ -84,7 +84,7 @@ public class CranePickDrop : MonoBehaviour if (timer < 0) { state = State.Tansporting; - crane.testTgt = dropTarget; + crane.targetTransform = dropTarget; } } diff --git a/Assets/Scripts/SlidingCrane.cs b/Assets/Scripts/SlidingCrane.cs index b85b08c..168b3ac 100644 --- a/Assets/Scripts/SlidingCrane.cs +++ b/Assets/Scripts/SlidingCrane.cs @@ -7,33 +7,55 @@ public class SlidingCrane : MonoBehaviour { public InertialInterpolator xMotion = InertialInterpolator.Default(); public InertialInterpolator yMotion = InertialInterpolator.Default(); + public InertialInterpolator heightMotion = InertialInterpolator.Default(); public Transform xTransform; public Transform yTransform; - public float yRange = 10; public float xRange = 5; + public float heightRange = 10; - public Transform testTgt; - public Vector3 target; + public float heightMax = -0.7f; + public float heightMin = -10; + + /// + /// if targetTrasnform is set, it will go to it. If null it will go to targetPoint + /// + public Transform targetTransform; + + /// + /// if targetTrasnform is set, it will go to it. If null it will go to targetPoint + /// + public Vector3 targetPoint; public Transform cradleTransform; public Rigidbody cradleRb; private void Start() { - target = transform.position; + targetPoint = transform.position; xMotion.progress = 0.5f; + + + + } + + private void Update() + { + if (Input.GetKeyDown(KeyCode.V)) + heightMotion.AccelerateTo(0); + if (Input.GetKeyDown(KeyCode.F)) + heightMotion.AccelerateTo(1); } void FixedUpdate() { - if (testTgt) - target = testTgt.position; + if (targetTransform) + targetPoint = targetTransform.position; - Vector3 localTarget = transform.InverseTransformPoint(target); + Vector3 localTarget = transform.InverseTransformPoint(targetPoint); Vector2 targetPlanar = new Vector2(localTarget.x, localTarget.z); @@ -48,10 +70,13 @@ public class SlidingCrane : MonoBehaviour xMotion.Update(Time.deltaTime); yMotion.Update(Time.deltaTime); + heightMotion.Update(Time.deltaTime); yTransform.localPosition = new Vector3(0, 0, yMotion.progress * yRange); xTransform.localPosition = new Vector3(x, 0, 0); //cradleRb.MovePosition(cradleTransform.position); + + cradleRb.transform.localPosition = new Vector3(0, Mathf.Lerp(heightMin, heightMax, heightMotion.progress), 0); } } From 3762b867aa8c4d5914bc2c1006ccfa8cb142d5b7 Mon Sep 17 00:00:00 2001 From: nothke Date: Mon, 19 Aug 2024 23:24:47 +0200 Subject: [PATCH 2/3] Crane now rises and drops --- Assets/Materials/transparent.mat | 91 +++ Assets/Materials/transparent.mat.meta | 8 + Assets/Prefabs/sliding_crane.prefab | 8 +- Assets/Scenes/Main.unity | 2 +- Assets/Scenes/test_crane.unity | 772 ++++++++++++++++++++++++++ Assets/Scenes/test_crane.unity.meta | 7 + Assets/Scripts/CranePickDrop.cs | 26 +- 7 files changed, 908 insertions(+), 6 deletions(-) create mode 100644 Assets/Materials/transparent.mat create mode 100644 Assets/Materials/transparent.mat.meta create mode 100644 Assets/Scenes/test_crane.unity create mode 100644 Assets/Scenes/test_crane.unity.meta diff --git a/Assets/Materials/transparent.mat b/Assets/Materials/transparent.mat new file mode 100644 index 0000000..7bcc458 --- /dev/null +++ b/Assets/Materials/transparent.mat @@ -0,0 +1,91 @@ +%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: transparent + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: [] + 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: 0.061, y: 0.061} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 4e76002f02c7e8c4290fb7bf8cb0fdc1, type: 3} + m_Scale: {x: 0.061, y: 0.061} + 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} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 3 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Shininess: 0.078125 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 0 + m_Colors: + - _Color: {r: 1, g: 0.81428593, b: 0.4386791, a: 0.5294118} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Materials/transparent.mat.meta b/Assets/Materials/transparent.mat.meta new file mode 100644 index 0000000..0e15d54 --- /dev/null +++ b/Assets/Materials/transparent.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 49c810880ec619a46949d4462ccf07b9 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/sliding_crane.prefab b/Assets/Prefabs/sliding_crane.prefab index de44576..f14124d 100644 --- a/Assets/Prefabs/sliding_crane.prefab +++ b/Assets/Prefabs/sliding_crane.prefab @@ -267,9 +267,9 @@ MonoBehaviour: accel: 0 braking: 0 heightMotion: - maxSpeed: 1 - acceleration: 1 - brakingAcceleration: 0 + maxSpeed: 0.5 + acceleration: 0.5 + brakingAcceleration: 0.5 progress: 0 velocity: 0 accel: 0 @@ -280,7 +280,7 @@ MonoBehaviour: xRange: 4.5 heightRange: 10 heightMax: -0.7 - heightMin: -8.5 + heightMin: -7.5 targetTransform: {fileID: 0} targetPoint: {x: 0, y: 0, z: 0} cradleTransform: {fileID: 6812918532662551388} diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 236ae92..74376c4 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -22408,7 +22408,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Objectives: [] - CurrentStage: 0 + CurrentStage: 4 --- !u!4 &1503113266 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/test_crane.unity b/Assets/Scenes/test_crane.unity new file mode 100644 index 0000000..aeb04c9 --- /dev/null +++ b/Assets/Scenes/test_crane.unity @@ -0,0 +1,772 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &108199368 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 108199373} + - component: {fileID: 108199372} + - component: {fileID: 108199371} + - component: {fileID: 108199370} + - component: {fileID: 108199369} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &108199369 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108199368} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d4053c90fd858e40a9093edff6b83c7, type: 3} + m_Name: + m_EditorClassIdentifier: + onEnterEvent: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1847617939} + m_TargetAssemblyTypeName: CranePickDrop, Assembly-CSharp + m_MethodName: OnTriggerEnterSignalReceived + m_Mode: 2 + m_Arguments: + m_ObjectArgument: {fileID: 108199369} + m_ObjectArgumentAssemblyTypeName: EnterTriggerSender, Assembly-CSharp + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + onExitEvent: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1847617939} + m_TargetAssemblyTypeName: CranePickDrop, Assembly-CSharp + m_MethodName: OnTriggerExitSignalReceived + m_Mode: 2 + m_Arguments: + m_ObjectArgument: {fileID: 108199369} + m_ObjectArgumentAssemblyTypeName: EnterTriggerSender, Assembly-CSharp + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + triggeredCollider: {fileID: 0} +--- !u!65 &108199370 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108199368} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &108199371 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108199368} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 49c810880ec619a46949d4462ccf07b9, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &108199372 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108199368} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &108199373 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108199368} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 5.34, y: 2.1, z: 20.54} + m_LocalScale: {x: 3.9816, y: 3.9816, z: 3.9816} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &592458002 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 592458005} + - component: {fileID: 592458004} + - component: {fileID: 592458003} + m_Layer: 0 + m_Name: Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &592458003 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 592458002} + m_Enabled: 1 +--- !u!20 &592458004 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 592458002} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &592458005 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 592458002} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 78.3779, y: -51.76418, z: -42.864254} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1228306005 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1228306006} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1228306006 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1228306005} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1325749538} + - {fileID: 1409510905} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1325749534 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1325749538} + - component: {fileID: 1325749537} + - component: {fileID: 1325749536} + - component: {fileID: 1325749535} + - component: {fileID: 1325749539} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &1325749535 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325749534} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &1325749536 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325749534} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 446234516a3ad9f4688247a490462c6e, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &1325749537 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325749534} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1325749538 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325749534} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0.125, z: 0} + m_LocalScale: {x: 100, y: 1, z: 100} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1228306006} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1325749539 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325749534} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: af3e57595c24e7b4dbb6f7f44db23525, type: 3} + m_Name: + m_EditorClassIdentifier: + Size: + x: 400 + y: 4 + z: 400 + CenterOffset: + x: 0 + y: -0.125 + z: 0 + cachedSize: + x: 400 + y: 4 + z: 400 + cachedOffset: + x: 0 + y: -0.125 + z: 0 +--- !u!1 &1409510904 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1409510905} + - component: {fileID: 1409510906} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1409510905 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409510904} + serializedVersion: 2 + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1228306006} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!108 &1409510906 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409510904} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 1 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!1001 &1764584009 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalPosition.x + value: 5.7285233 + objectReference: {fileID: 0} + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalPosition.y + value: 5.98 + objectReference: {fileID: 0} + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalPosition.z + value: 20.749737 + objectReference: {fileID: 0} + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6297052809674953331, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7947812480369148219, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} + propertyPath: m_Name + value: Basic Torus + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: d5cbaa49bd379dc49b90d9c38f02bf80, type: 3} +--- !u!114 &1847617939 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5328903551856804412, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + m_PrefabInstance: {fileID: 2041063257} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ad97f65d702892042b008aaa97b9c17e, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &2041063257 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3986187515445640859, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalPosition.y + value: -7 + objectReference: {fileID: 0} + - target: {fileID: 4060506572131258815, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_Name + value: sliding_crane + objectReference: {fileID: 0} + - target: {fileID: 5468670891441072218, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LinearLimit.limit + value: 1.5 + objectReference: {fileID: 0} + - target: {fileID: 5575607870997596000, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalPosition.x + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalPosition.x + value: -0.25 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalPosition.y + value: 0.9299998 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalPosition.z + value: -19.75 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 1228306006} + - {fileID: 2041063257} + - {fileID: 592458005} + - {fileID: 108199373} + - {fileID: 1764584009} diff --git a/Assets/Scenes/test_crane.unity.meta b/Assets/Scenes/test_crane.unity.meta new file mode 100644 index 0000000..a9f5d13 --- /dev/null +++ b/Assets/Scenes/test_crane.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 412ddf432dadca64d9e98cda0df2331b +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/CranePickDrop.cs b/Assets/Scripts/CranePickDrop.cs index 5ba61c1..8609a39 100644 --- a/Assets/Scripts/CranePickDrop.cs +++ b/Assets/Scripts/CranePickDrop.cs @@ -18,6 +18,7 @@ public class CranePickDrop : MonoBehaviour Catching, WaitingToCatch, Tansporting, + WaitBeforeDrop, Finished, } @@ -50,6 +51,7 @@ public class CranePickDrop : MonoBehaviour void Start() { magnetStrength = magnet.strength; + crane.heightMotion.AccelerateTo(1); } void Update() @@ -64,6 +66,11 @@ public class CranePickDrop : MonoBehaviour return; } + if (magnet.IsCloseToPlanar(handlingBody, 10f)) + { + crane.heightMotion.AccelerateTo(0); + } + if (magnet.IsCloseTo(handlingBody, 5f)) { magnet.strength = magnetStrength; @@ -85,15 +92,32 @@ public class CranePickDrop : MonoBehaviour { state = State.Tansporting; crane.targetTransform = dropTarget; + crane.heightMotion.AccelerateTo(1); } } else if (state == State.Tansporting) { - if (magnet.IsCloseToPlanar(dropTarget)) + if (magnet.IsCloseToPlanar(dropTarget, 10f)) + { + crane.heightMotion.AccelerateTo(0); + } + + if (magnet.IsCloseToPlanar(dropTarget, 3f)) + { + state = State.WaitBeforeDrop; + timer = 3; + } + } + else if (state == State.WaitBeforeDrop) + { + timer -= Time.deltaTime; + + if (timer < 0) { magnet.strength = 0; state = State.Idle; + crane.heightMotion.AccelerateTo(1); } } } From 71f05400e46b559b915f4ebaece7c7a6f22a9f89 Mon Sep 17 00:00:00 2001 From: nothke Date: Mon, 19 Aug 2024 23:32:28 +0200 Subject: [PATCH 3/3] Hammer now taken on start --- Assets/Scenes/Main.unity | 27 ++++++++++++++++++++++++++ Assets/Scripts/SetItemsOnStart.cs | 20 +++++++++++++++++++ Assets/Scripts/SetItemsOnStart.cs.meta | 11 +++++++++++ 3 files changed, 58 insertions(+) create mode 100644 Assets/Scripts/SetItemsOnStart.cs create mode 100644 Assets/Scripts/SetItemsOnStart.cs.meta diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 74376c4..726fde4 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -8568,6 +8568,17 @@ Transform: m_CorrespondingSourceObject: {fileID: 8393158071281731187, guid: d594a9afcbadc3646be0b679de9ca105, type: 3} m_PrefabInstance: {fileID: 528109184} m_PrefabAsset: {fileID: 0} +--- !u!114 &532119488 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 586259664102464044, guid: dbb480e8a73da05448bd6efa47d448b0, type: 3} + m_PrefabInstance: {fileID: 2017149079} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 84817382e549d8b4797caa3a4891df6b, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &536646929 PrefabInstance: m_ObjectHideFlags: 0 @@ -11753,6 +11764,7 @@ GameObject: - component: {fileID: 687919026} - component: {fileID: 687919025} - component: {fileID: 687919024} + - component: {fileID: 687919030} m_Layer: 0 m_Name: Interaction m_TagString: Untagged @@ -11894,6 +11906,21 @@ MonoBehaviour: throwKey: 102 examineKey: 101 placeKey: 116 +--- !u!114 &687919030 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 687919022} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb13478e4c42bd7489db482354f8b915, type: 3} + m_Name: + m_EditorClassIdentifier: + hands: {fileID: 687919027} + items: + - {fileID: 532119488} --- !u!1001 &719329539 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/SetItemsOnStart.cs b/Assets/Scripts/SetItemsOnStart.cs new file mode 100644 index 0000000..3093b14 --- /dev/null +++ b/Assets/Scripts/SetItemsOnStart.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Nothke.Interaction; +using Nothke.Interaction.Items; + +public class SetItemsOnStart : MonoBehaviour +{ + public Hands hands; + + public GenericItem[] items; + + void Start() + { + foreach (var item in items) + { + hands.Take(item); + } + } +} diff --git a/Assets/Scripts/SetItemsOnStart.cs.meta b/Assets/Scripts/SetItemsOnStart.cs.meta new file mode 100644 index 0000000..41eec2a --- /dev/null +++ b/Assets/Scripts/SetItemsOnStart.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bb13478e4c42bd7489db482354f8b915 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: