From dd1c0284ab11802c7b2410c94c23755578c078e4 Mon Sep 17 00:00:00 2001 From: nothke Date: Sat, 17 Aug 2024 16:55:28 +0200 Subject: [PATCH] Magnet no longer sticking to itself, and crane stuff --- Assets/Prefabs/sliding_crane.prefab | 364 +++++++++++++++++- .../Scenes/test_conveyor_belt_character.unity | 260 +++---------- Assets/Scripts/Magnet.cs | 2 +- 3 files changed, 419 insertions(+), 207 deletions(-) diff --git a/Assets/Prefabs/sliding_crane.prefab b/Assets/Prefabs/sliding_crane.prefab index 987cd1f..3e03216 100644 --- a/Assets/Prefabs/sliding_crane.prefab +++ b/Assets/Prefabs/sliding_crane.prefab @@ -9,6 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 7667905692431622915} + - component: {fileID: 4852641824795110997} m_Layer: 0 m_Name: crane_overhead m_TagString: Untagged @@ -31,8 +32,235 @@ Transform: m_Children: - {fileID: 6260903793745956400} - {fileID: 523245088033526470} + - {fileID: 1520758223515527804} m_Father: {fileID: 4939426218529386488} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!54 &4852641824795110997 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1081172236811645040} + serializedVersion: 4 + m_Mass: 1 + 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!1 &1480716933029547899 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1520758223515527804} + - component: {fileID: 8437660771791062027} + - component: {fileID: 3319133739863316346} + - component: {fileID: 3964864061967394476} + - component: {fileID: 6732188953862569023} + m_Layer: 0 + m_Name: Magnet + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1520758223515527804 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1480716933029547899} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.9599998, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 5960009208899736097} + m_Father: {fileID: 7667905692431622915} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8437660771791062027 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1480716933029547899} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b236863c86ffb73498f0262aaf900afd, type: 3} + m_Name: + m_EditorClassIdentifier: + strength: 200 +--- !u!135 &3319133739863316346 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1480716933029547899} + 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_Radius: 3.373948 + m_Center: {x: 0, y: 0, z: 0} +--- !u!54 &3964864061967394476 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1480716933029547899} + serializedVersion: 4 + m_Mass: 50 + 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: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 +--- !u!153 &6732188953862569023 +ConfigurableJoint: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1480716933029547899} + m_ConnectedBody: {fileID: 4852641824795110997} + m_ConnectedArticulationBody: {fileID: 0} + m_Anchor: {x: 0, y: 0.37, z: 0} + m_Axis: {x: 1, y: 0, z: 0} + m_AutoConfigureConnectedAnchor: 0 + m_ConnectedAnchor: {x: 0, y: 0, z: 0} + serializedVersion: 3 + m_SecondaryAxis: {x: 0, y: 1, z: 0} + m_XMotion: 1 + m_YMotion: 1 + m_ZMotion: 1 + m_AngularXMotion: 2 + m_AngularYMotion: 2 + m_AngularZMotion: 2 + m_LinearLimitSpring: + spring: 0 + damper: 0 + m_LinearLimit: + limit: 4 + bounciness: 0 + contactDistance: 0 + m_AngularXLimitSpring: + spring: 0 + damper: 0 + m_LowAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_HighAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularYZLimitSpring: + spring: 0 + damper: 0 + m_AngularYLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularZLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_TargetPosition: {x: 0, y: 0, z: 0} + m_TargetVelocity: {x: 0, y: 0, z: 0} + m_XDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_YDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_TargetRotation: {x: 0, y: 0, z: 0, w: 1} + m_TargetAngularVelocity: {x: 0, y: 0, z: 0} + m_RotationDriveMode: 0 + m_AngularXDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_AngularYZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_SlerpDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ProjectionMode: 0 + m_ProjectionDistance: 0.1 + m_ProjectionAngle: 180 + m_ConfiguredInWorldSpace: 0 + m_SwapBodies: 0 + m_BreakForce: Infinity + m_BreakTorque: Infinity + m_EnableCollision: 0 + m_EnablePreprocessing: 1 + m_MassScale: 1 + m_ConnectedMassScale: 1 --- !u!1 &2016578174635656181 GameObject: m_ObjectHideFlags: 0 @@ -390,6 +618,7 @@ GameObject: m_Component: - component: {fileID: 8361960510235702639} - component: {fileID: 4095986436202916730} + - component: {fileID: 5328903551856804412} m_Layer: 0 m_Name: sliding_crane m_TagString: Untagged @@ -405,7 +634,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4060506572131258815} serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 20.26, y: 0, z: 28.17} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -428,7 +657,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: xMotion: - maxSpeed: 0.5 + maxSpeed: 1 acceleration: 0.5 brakingAcceleration: 0.5 progress: 0 @@ -436,7 +665,7 @@ MonoBehaviour: accel: 0 braking: 0 yMotion: - maxSpeed: 0.07 + maxSpeed: 1 acceleration: 0.5 brakingAcceleration: 0.5 progress: 0 @@ -449,6 +678,24 @@ MonoBehaviour: xRange: 4.5 testTgt: {fileID: 0} target: {x: 0, y: 0, z: 0} +--- !u!114 &5328903551856804412 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4060506572131258815} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ad97f65d702892042b008aaa97b9c17e, type: 3} + m_Name: + m_EditorClassIdentifier: + crane: {fileID: 4095986436202916730} + magnet: {fileID: 8437660771791062027} + dropTarget: {fileID: 0} + handlingBody: {fileID: 0} + magnetStrength: 0 + state: 0 --- !u!1 &4153062909212349468 GameObject: m_ObjectHideFlags: 0 @@ -581,8 +828,8 @@ Transform: m_GameObject: {fileID: 5520851031552772982} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -3.12, z: 0} - m_LocalScale: {x: 0.18936521, y: 6.540553, z: 0.16858572} + m_LocalPosition: {x: 0, y: -1.74, z: 0} + m_LocalScale: {x: 0.18936521, y: 4.185365, z: 0.16858572} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 7667905692431622915} @@ -742,6 +989,113 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &6124499960613037686 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5960009208899736097} + - component: {fileID: 7645466966465864913} + - component: {fileID: 3881322828103201164} + - component: {fileID: 8117783407591015127} + m_Layer: 0 + m_Name: rer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5960009208899736097 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6124499960613037686} + 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: 0.19315, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1520758223515527804} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7645466966465864913 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6124499960613037686} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &3881322828103201164 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6124499960613037686} + 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: 10303, guid: 0000000000000000f000000000000000, type: 0} + 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!136 &8117783407591015127 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6124499960613037686} + 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: 2 + m_Radius: 0.5000001 + m_Height: 2 + m_Direction: 1 + m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} --- !u!1 &6904222991103733248 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/test_conveyor_belt_character.unity b/Assets/Scenes/test_conveyor_belt_character.unity index f934439..ccfde65 100644 --- a/Assets/Scenes/test_conveyor_belt_character.unity +++ b/Assets/Scenes/test_conveyor_belt_character.unity @@ -822,18 +822,54 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 523245088033526470, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} - propertyPath: m_LocalScale.y - value: 4.185365 - objectReference: {fileID: 0} - - target: {fileID: 523245088033526470, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + - target: {fileID: 1520758223515527804, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} propertyPath: m_LocalPosition.y - value: -1.74 + value: -4.22 objectReference: {fileID: 0} + - target: {fileID: 3881322828103201164, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 241446fb42920fe46b66d2b7e6127c28, type: 2} - target: {fileID: 4060506572131258815, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} propertyPath: m_Name value: sliding_crane objectReference: {fileID: 0} + - target: {fileID: 5328903551856804412, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: dropTarget + value: + objectReference: {fileID: 1302384508} + - target: {fileID: 5960009208899736097, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LocalPosition.y + value: 0.3 + objectReference: {fileID: 0} + - target: {fileID: 6732188953862569023, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_AngularXMotion + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 6732188953862569023, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_AngularYMotion + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 6732188953862569023, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_AngularZMotion + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 6732188953862569023, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_AngularYLimit.limit + value: 50 + objectReference: {fileID: 0} + - target: {fileID: 6732188953862569023, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_AngularZLimit.limit + value: 50 + objectReference: {fileID: 0} + - target: {fileID: 6732188953862569023, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_LowAngularXLimit.limit + value: -50 + objectReference: {fileID: 0} + - target: {fileID: 6732188953862569023, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + propertyPath: m_HighAngularXLimit.limit + value: 50 + objectReference: {fileID: 0} - target: {fileID: 8361960510235702639, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} propertyPath: m_LocalPosition.x value: -69.1 @@ -874,16 +910,14 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - m_RemovedComponents: [] + m_RemovedComponents: + - {fileID: 8117783407591015127, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} m_RemovedGameObjects: [] - m_AddedGameObjects: - - targetCorrespondingSourceObject: {fileID: 7667905692431622915, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} - insertIndex: -1 - addedObject: {fileID: 1711954333} + m_AddedGameObjects: [] m_AddedComponents: - - targetCorrespondingSourceObject: {fileID: 4060506572131258815, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + - targetCorrespondingSourceObject: {fileID: 6124499960613037686, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} insertIndex: -1 - addedObject: {fileID: 1928367872} + addedObject: {fileID: 1757469724} m_SourcePrefab: {fileID: 100100000, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} --- !u!1 &1506372643 GameObject: @@ -1018,11 +1052,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 86.608, y: 0, z: 19.775} ---- !u!4 &1559054413 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 7667905692431622915, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} - m_PrefabInstance: {fileID: 1472280155} - m_PrefabAsset: {fileID: 0} --- !u!1 &1564899495 GameObject: m_ObjectHideFlags: 0 @@ -1128,110 +1157,13 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1711954332 +--- !u!1 &1757469719 stripped GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} + m_CorrespondingSourceObject: {fileID: 6124499960613037686, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} + m_PrefabInstance: {fileID: 1472280155} m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1711954333} - - component: {fileID: 1711954334} - - component: {fileID: 1711954335} - m_Layer: 0 - m_Name: Magnet - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1711954333 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1711954332} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -3.9599998, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 1757469720} - m_Father: {fileID: 1559054413} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1711954334 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1711954332} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b236863c86ffb73498f0262aaf900afd, type: 3} - m_Name: - m_EditorClassIdentifier: - strength: 50 ---- !u!135 &1711954335 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1711954332} - 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_Radius: 8.713587 - m_Center: {x: 0, y: 0, z: 0} ---- !u!1 &1757469719 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1757469720} - - component: {fileID: 1757469723} - - component: {fileID: 1757469722} - - component: {fileID: 1757469721} - m_Layer: 0 - m_Name: rer - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1757469720 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1757469719} - 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: 0.19315, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1711954333} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!136 &1757469721 -CapsuleCollider: +--- !u!64 &1757469724 +MeshCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -1248,60 +1180,9 @@ CapsuleCollider: m_IsTrigger: 0 m_ProvidesContacts: 0 m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.5000001 - m_Height: 2 - m_Direction: 1 - m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} ---- !u!23 &1757469722 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1757469719} - 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: 10303, guid: 0000000000000000f000000000000000, type: 0} - 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 &1757469723 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1757469719} + serializedVersion: 5 + m_Convex: 1 + m_CookingOptions: 30 m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &1793071883 GameObject: @@ -1349,40 +1230,17 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1928367869 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 4060506572131258815, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} +--- !u!114 &1928367872 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5328903551856804412, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} m_PrefabInstance: {fileID: 1472280155} m_PrefabAsset: {fileID: 0} ---- !u!114 &1928367870 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 4095986436202916730, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} - m_PrefabInstance: {fileID: 1472280155} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1928367869} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: da3ed29216d73fb43be6448aea116576, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!114 &1928367872 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1928367869} + m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: ad97f65d702892042b008aaa97b9c17e, type: 3} m_Name: m_EditorClassIdentifier: - crane: {fileID: 1928367870} - magnet: {fileID: 1711954334} - dropTarget: {fileID: 1302384508} - handlingBody: {fileID: 0} - magnetStrength: 0 - state: 0 --- !u!1001 &1931408570 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Magnet.cs b/Assets/Scripts/Magnet.cs index ac964cd..332f58a 100644 --- a/Assets/Scripts/Magnet.cs +++ b/Assets/Scripts/Magnet.cs @@ -13,7 +13,7 @@ public class Magnet : MonoBehaviour { var otherRb = other.attachedRigidbody; - if (otherRb) + if (otherRb && otherRb.isKinematic == false) { Vector3 dir = otherRb.position - transform.position; float dirSq = Vector3.SqrMagnitude(dir);