From 30f007b7f08da9111bd254e8984647066ccaf446 Mon Sep 17 00:00:00 2001 From: Joshua Reason Date: Sun, 5 Feb 2023 15:11:07 +1100 Subject: [PATCH] Set up freg IK --- Assets/Art Assets/Animation.meta | 8 + .../Animation/FregController.controller | 73 ++ .../Animation/FregController.controller.meta | 8 + Assets/Art Assets/Models/Freg_T-Pose.fbx.meta | 710 +++++++++++++++++- Assets/Prefab/Player.prefab | 4 +- Assets/Scenes/BoatTest.unity | 4 +- .../Development/CharacterControllerTest.unity | 4 +- Assets/Scripts/Player/HandController.cs | 18 +- Assets/Scripts/Player/IkController.cs | 99 +++ Assets/Scripts/Player/IkController.cs.meta | 11 + Assets/{Scenes => Scripts}/Utility.meta | 0 .../Utility/CopyTransform.cs | 0 .../Utility/CopyTransform.cs.meta | 0 ProjectSettings/ShaderGraphSettings.asset | 4 +- 14 files changed, 925 insertions(+), 18 deletions(-) create mode 100644 Assets/Art Assets/Animation.meta create mode 100644 Assets/Art Assets/Animation/FregController.controller create mode 100644 Assets/Art Assets/Animation/FregController.controller.meta create mode 100644 Assets/Scripts/Player/IkController.cs create mode 100644 Assets/Scripts/Player/IkController.cs.meta rename Assets/{Scenes => Scripts}/Utility.meta (100%) rename Assets/{Scenes => Scripts}/Utility/CopyTransform.cs (100%) rename Assets/{Scenes => Scripts}/Utility/CopyTransform.cs.meta (100%) diff --git a/Assets/Art Assets/Animation.meta b/Assets/Art Assets/Animation.meta new file mode 100644 index 0000000..1a0fe3c --- /dev/null +++ b/Assets/Art Assets/Animation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2438fa2df3e97e047804e7aa95576bbd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Art Assets/Animation/FregController.controller b/Assets/Art Assets/Animation/FregController.controller new file mode 100644 index 0000000..70b173a --- /dev/null +++ b/Assets/Art Assets/Animation/FregController.controller @@ -0,0 +1,73 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-7947158109147835962 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: T_pose + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: -203655887218126122, guid: 63c6c6ecfa3ccf943a834cceca0f6eab, + type: 3} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-4407937962629104252 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -7947158109147835962} + m_Position: {x: 312, y: 202, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -7947158109147835962} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: FregController + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -4407937962629104252} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 1 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Art Assets/Animation/FregController.controller.meta b/Assets/Art Assets/Animation/FregController.controller.meta new file mode 100644 index 0000000..9a53abe --- /dev/null +++ b/Assets/Art Assets/Animation/FregController.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e1f75726e8d22ba40ba8029c79bcf59f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Art Assets/Models/Freg_T-Pose.fbx.meta b/Assets/Art Assets/Models/Freg_T-Pose.fbx.meta index 5ad6ca8..807555d 100644 --- a/Assets/Art Assets/Models/Freg_T-Pose.fbx.meta +++ b/Assets/Art Assets/Models/Freg_T-Pose.fbx.meta @@ -24,18 +24,47 @@ ModelImporter: animationDoRetargetingWarnings: 0 importAnimatedCustomProperties: 0 importConstraints: 0 - animationCompression: 1 + animationCompression: 3 animationRotationError: 0.5 animationPositionError: 0.5 animationScaleError: 0.5 animationWrapMode: 0 extraExposedTransformPaths: [] extraUserProperties: [] - clipAnimations: [] + clipAnimations: + - serializedVersion: 16 + name: T_pose + takeName: mixamo.com + internalID: -203655887218126122 + firstFrame: 0 + lastFrame: 1 + wrapMode: 0 + orientationOffsetY: 0 + level: 0 + cycleOffset: 0 + loop: 0 + hasAdditiveReferencePose: 0 + loopTime: 0 + loopBlend: 0 + loopBlendOrientation: 0 + loopBlendPositionY: 0 + loopBlendPositionXZ: 0 + keepOriginalOrientation: 0 + keepOriginalPositionY: 1 + keepOriginalPositionXZ: 0 + heightFromFeet: 0 + mirror: 0 + bodyMask: 01000000010000000100000001000000010000000000000000000000000000000000000001000000010000000100000001000000 + curves: [] + events: [] + transformMask: [] + maskType: 3 + maskSource: {instanceID: 0} + additiveReferencePoseFrame: 0 isReadable: 0 meshes: lODScreenPercentages: [] - globalScale: 1 + globalScale: 0.17 meshCompression: 0 addColliders: 0 useSRGBMaterialColor: 1 @@ -79,23 +108,686 @@ ModelImporter: importAnimation: 1 humanDescription: serializedVersion: 3 - human: [] - skeleton: [] + human: + - boneName: mixamorig:Hips + humanName: Hips + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftUpLeg + humanName: LeftUpperLeg + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightUpLeg + humanName: RightUpperLeg + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftLeg + humanName: LeftLowerLeg + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightLeg + humanName: RightLowerLeg + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftFoot + humanName: LeftFoot + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightFoot + humanName: RightFoot + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:Spine + humanName: Spine + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:Spine1 + humanName: Chest + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:Neck + humanName: Neck + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:Head + humanName: Head + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftShoulder + humanName: LeftShoulder + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightShoulder + humanName: RightShoulder + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftArm + humanName: LeftUpperArm + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightArm + humanName: RightUpperArm + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftForeArm + humanName: LeftLowerArm + limit: + min: {x: -90, y: 0, z: -80} + max: {x: 90, y: 0, z: 80} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 1 + - boneName: mixamorig:RightForeArm + humanName: RightLowerArm + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHand + humanName: LeftHand + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHand + humanName: RightHand + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftToeBase + humanName: LeftToes + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightToeBase + humanName: RightToes + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandThumb1 + humanName: Left Thumb Proximal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandThumb2 + humanName: Left Thumb Intermediate + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandThumb3 + humanName: Left Thumb Distal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandIndex1 + humanName: Left Index Proximal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandIndex2 + humanName: Left Index Intermediate + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandIndex3 + humanName: Left Index Distal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandMiddle1 + humanName: Left Middle Proximal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandMiddle2 + humanName: Left Middle Intermediate + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandMiddle3 + humanName: Left Middle Distal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandRing1 + humanName: Left Ring Proximal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandRing2 + humanName: Left Ring Intermediate + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:LeftHandRing3 + humanName: Left Ring Distal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandThumb1 + humanName: Right Thumb Proximal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandThumb2 + humanName: Right Thumb Intermediate + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandThumb3 + humanName: Right Thumb Distal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandIndex1 + humanName: Right Index Proximal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandIndex2 + humanName: Right Index Intermediate + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandIndex3 + humanName: Right Index Distal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandMiddle1 + humanName: Right Middle Proximal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandMiddle2 + humanName: Right Middle Intermediate + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandMiddle3 + humanName: Right Middle Distal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandRing1 + humanName: Right Ring Proximal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandRing2 + humanName: Right Ring Intermediate + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:RightHandRing3 + humanName: Right Ring Distal + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + - boneName: mixamorig:Spine2 + humanName: UpperChest + limit: + min: {x: 0, y: 0, z: 0} + max: {x: 0, y: 0, z: 0} + value: {x: 0, y: 0, z: 0} + length: 0 + modified: 0 + skeleton: + - name: Freg_T-Pose(Clone) + parentName: + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: Freg + parentName: Freg_T-Pose(Clone) + position: {x: -0, y: 0, z: 0} + rotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} + scale: {x: 100, y: 100, z: 100} + - name: mixamorig:Hips + parentName: Freg_T-Pose(Clone) + position: {x: -0.000000102896145, y: 1.6609266, z: -0.0018054076} + rotation: {x: 1.10861834e-10, y: -0.00000002152418, z: 0.0000007499091, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:Spine + parentName: mixamorig:Hips + position: {x: -0, y: 0.123161286, z: -0.011139075} + rotation: {x: -0.045083504, y: 0.00000005531034, z: -0.00000074817723, w: 0.99898326} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:Spine1 + parentName: mixamorig:Spine + position: {x: -0, y: 0.14427468, z: 1.7768176e-10} + rotation: {x: 7.018601e-26, y: -1.0390106e-13, z: 6.755081e-13, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:Spine2 + parentName: mixamorig:Spine1 + position: {x: -0, y: 0.16488506, z: -2.4558364e-10} + rotation: {x: 0, y: -0, z: -1.4988356e-29, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:Neck + parentName: mixamorig:Spine2 + position: {x: -0, y: 0.1854958, z: 0.000000025045633} + rotation: {x: 0.045083612, y: 3.233916e-14, z: 2.2906452e-13, w: 0.99898326} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:Head + parentName: mixamorig:Neck + position: {x: -0, y: 0.22998667, z: 0.01052102} + rotation: {x: 0, y: -0, z: -6.794357e-36, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:HeadTop_End + parentName: mixamorig:Head + position: {x: -0, y: 0.57105625, z: 0.026123662} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightShoulder + parentName: mixamorig:Spine2 + position: {x: 0.11822756, y: 0.17456128, z: -0.0016091992} + rotation: {x: 0.48438, y: 0.5146479, z: -0.48473686, w: 0.51530945} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightArm + parentName: mixamorig:RightShoulder + position: {x: -3.226581e-11, y: 0.23750229, z: -1.3496536e-10} + rotation: {x: 0.030386982, y: 0.03824031, z: 0.0009954084, w: 0.99880594} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightForeArm + parentName: mixamorig:RightArm + position: {x: 2.858576e-10, y: 0.5169594, z: 0.0000000067340404} + rotation: {x: 0.000000036448416, y: 0.00002214491, z: 0.00000020349222, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHand + parentName: mixamorig:RightForeArm + position: {x: -1.3463869e-12, y: 0.56330055, z: 0.0000000023139064} + rotation: {x: -0.025483876, y: 0.0050663436, z: 0.0010220521, w: 0.99966186} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandIndex1 + parentName: mixamorig:RightHand + position: {x: -0.043221526, y: 0.09376483, z: 0.00087934243} + rotation: {x: 0.025488509, y: 0.0001179746, z: 0.0010658845, w: 0.99967456} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandIndex2 + parentName: mixamorig:RightHandIndex1 + position: {x: 0.0004327134, y: 0.11062384, z: 0.000000003784188} + rotation: {x: 0.00000014747906, y: 0.00016152766, z: -0.002870189, w: 0.9999959} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandIndex3 + parentName: mixamorig:RightHandIndex2 + position: {x: -0.00018019667, y: 0.09850783, z: -0.0000000052194844} + rotation: {x: 0.00000028781594, y: -0.000075062686, z: -0.000545697, w: 0.9999999} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandIndex4 + parentName: mixamorig:RightHandIndex3 + position: {x: -0.00025251528, y: 0.08643244, z: 8.854146e-10} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandMiddle1 + parentName: mixamorig:RightHand + position: {x: 0.00016771068, y: 0.09385455, z: 0.00478913} + rotation: {x: 0.025488157, y: 0.00010997656, z: -0.0017973452, w: 0.99967355} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandMiddle2 + parentName: mixamorig:RightHandMiddle1 + position: {x: -0.00019988108, y: 0.11022704, z: 0.0000000032219314} + rotation: {x: -0.00000015312436, y: -0.00010129575, z: 0.0012558104, w: 0.9999992} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandMiddle3 + parentName: mixamorig:RightHandMiddle2 + position: {x: 0.00007054719, y: 0.10112934, z: -9.933717e-10} + rotation: {x: 0.00000035540253, y: 0.000063089814, z: 0.00039491084, w: 0.99999994} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandMiddle4 + parentName: mixamorig:RightHandMiddle3 + position: {x: 0.00012933392, y: 0.08696552, z: 0.0000000012471244} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandRing1 + parentName: mixamorig:RightHand + position: {x: 0.043053813, y: 0.08617251, z: 0.00030594948} + rotation: {x: 0.02548902, y: -0.0003455956, z: -0.004140899, w: 0.99966645} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandRing2 + parentName: mixamorig:RightHandRing1 + position: {x: -0.0007493473, y: 0.1157149, z: 0.000000010468865} + rotation: {x: 0.00000033538743, y: -0.00032235464, z: 0.0042382437, w: 0.999991} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandRing3 + parentName: mixamorig:RightHandRing2 + position: {x: 0.00020480058, y: 0.10240191, z: 0.000000004206175} + rotation: {x: 0.0000013790376, y: 0.00030103352, z: 0.0021116615, w: 0.99999774} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandRing4 + parentName: mixamorig:RightHandRing3 + position: {x: 0.0005445452, y: 0.08748255, z: 5.5972604e-10} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandThumb1 + parentName: mixamorig:RightHand + position: {x: -0.0435905, y: 0.05746552, z: -0.00142744} + rotation: {x: 0.087615564, y: 0.007940574, z: 0.40449876, w: 0.91029733} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandThumb2 + parentName: mixamorig:RightHandThumb1 + position: {x: 0.0068740644, y: 0.057302702, z: 1.7928549e-10} + rotation: {x: 0.000002866269, y: -0.00016101592, z: -0.13705553, w: 0.9905634} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandThumb3 + parentName: mixamorig:RightHandThumb2 + position: {x: -0.01423339, y: 0.09074358, z: 0.0000000012088461} + rotation: {x: -0.000044853146, y: 0.001245363, z: 0.1194256, w: 0.9928424} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightHandThumb4 + parentName: mixamorig:RightHandThumb3 + position: {x: 0.0073593305, y: 0.08757491, z: -0.000000004206849} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftShoulder + parentName: mixamorig:Spine2 + position: {x: -0.11822756, y: 0.17445, z: -0.00037873464} + rotation: {x: 0.48752636, y: -0.51214236, z: 0.48207942, w: 0.5173275} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftArm + parentName: mixamorig:LeftShoulder + position: {x: -7.422081e-12, y: 0.23750229, z: -1.3857018e-10} + rotation: {x: 0.030164793, y: -0.050302494, z: 0.0037984836, w: 0.99827117} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftForeArm + parentName: mixamorig:LeftArm + position: {x: -8.5651444e-11, y: 0.5169542, z: -0.0000000067278396} + rotation: {x: -0.00000015776874, y: -0.000054749627, z: -0.00000001786266, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHand + parentName: mixamorig:LeftForeArm + position: {x: 1.2652455e-10, y: 0.56328917, z: 0.0000000032289906} + rotation: {x: 0.017183997, y: 0.0025659509, z: -0.0107588805, w: 0.9997912} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandIndex1 + parentName: mixamorig:LeftHand + position: {x: 0.045861457, y: 0.095392264, z: 0.0020760978} + rotation: {x: -0.017218854, y: 0.0006020723, z: 0.009020056, w: 0.9998109} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandIndex2 + parentName: mixamorig:LeftHandIndex1 + position: {x: -0.00035675758, y: 0.10594783, z: -0.0000000038555017} + rotation: {x: 0.0000002010197, y: -0.00017040034, z: 0.002160759, w: 0.9999977} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandIndex3 + parentName: mixamorig:LeftHandIndex2 + position: {x: 0.00009746085, y: 0.102173395, z: 0.0000000030582026} + rotation: {x: -0.000000057950903, y: 0.00016423328, z: 0.0010220724, w: 0.99999946} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandIndex4 + parentName: mixamorig:LeftHandIndex3 + position: {x: 0.00025929834, y: 0.08648212, z: 7.095787e-10} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandMiddle1 + parentName: mixamorig:LeftHand + position: {x: -0.0020108602, y: 0.09378127, z: -0.003230106} + rotation: {x: -0.017208388, y: -0.00021214575, z: 0.01113024, w: 0.99978995} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandMiddle2 + parentName: mixamorig:LeftHandMiddle1 + position: {x: 0.000088439905, y: 0.107404545, z: -0.0000000043620627} + rotation: {x: -0.00000023261757, y: 0.000030042233, z: -0.00059080124, w: 0.9999998} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandMiddle3 + parentName: mixamorig:LeftHandMiddle2 + position: {x: -0.000035507004, y: 0.0990798, z: -0.000000003198235} + rotation: {x: 0.0000001296454, y: 0.000012546951, z: -0.00013962385, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandMiddle4 + parentName: mixamorig:LeftHandMiddle3 + position: {x: -0.000052932857, y: 0.08291154, z: 0.0000000038994408} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandRing1 + parentName: mixamorig:LeftHand + position: {x: -0.043850597, y: 0.0878519, z: 0.0028484527} + rotation: {x: -0.017197065, y: -0.0018524512, z: 0.013962409, w: 0.99975294} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandRing2 + parentName: mixamorig:LeftHandRing1 + position: {x: 0.0007312821, y: 0.11371003, z: 0.0000000050498534} + rotation: {x: 0.00000086448256, y: 0.00030248676, z: -0.0044981623, w: 0.99998987} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandRing3 + parentName: mixamorig:LeftHandRing2 + position: {x: -0.00025916673, y: 0.10108424, z: 0.0000000015748618} + rotation: {x: 0.0000010129552, y: -0.00021025403, z: -0.0014042362, w: 0.999999} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandRing4 + parentName: mixamorig:LeftHandRing3 + position: {x: -0.0004721146, y: 0.08785986, z: -8.1122736e-10} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandThumb1 + parentName: mixamorig:LeftHand + position: {x: 0.042163435, y: 0.0577421, z: 0.00080182165} + rotation: {x: 0.051420353, y: -0.0036998703, z: -0.40421388, w: 0.9132105} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandThumb2 + parentName: mixamorig:LeftHandThumb1 + position: {x: -0.008024691, y: 0.056636013, z: 8.8417085e-10} + rotation: {x: 0.000000016215065, y: 0.000008732834, z: 0.13974327, w: 0.99018776} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandThumb3 + parentName: mixamorig:LeftHandThumb2 + position: {x: 0.012851872, y: 0.09142811, z: -0.0000000017963245} + rotation: {x: 0.00011301527, y: 0.0025927569, z: -0.09600683, w: 0.9953773} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftHandThumb4 + parentName: mixamorig:LeftHandThumb3 + position: {x: -0.004827185, y: 0.091585144, z: -0.0000000054228075} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightUpLeg + parentName: mixamorig:Hips + position: {x: 0.16960973, y: -0.06853022, z: -0.0026564335} + rotation: {x: -0.0000034893098, y: -0.008072721, z: 0.9999673, w: -0.00062096445} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightLeg + parentName: mixamorig:RightUpLeg + position: {x: 2.1349068e-11, y: 0.8158371, z: -8.733406e-10} + rotation: {x: -0.013996192, y: 0.000042008713, z: -0.0013579024, w: 0.9999011} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightFoot + parentName: mixamorig:RightLeg + position: {x: -2.0847563e-11, y: 0.68990165, z: 3.1174127e-10} + rotation: {x: 0.5772244, y: 0.008130766, z: -0.0052172826, w: 0.8165285} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightToeBase + parentName: mixamorig:RightFoot + position: {x: 2.0368637e-10, y: 0.20748112, z: -0.000000003222405} + rotation: {x: 0.1660197, y: 0.0016160661, z: 0.009598631, w: 0.98607445} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:RightToe_End + parentName: mixamorig:RightToeBase + position: {x: -2.3711526e-13, y: 0.08078485, z: -3.0264846e-11} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftUpLeg + parentName: mixamorig:Hips + position: {x: -0.16960973, y: -0.06853022, z: -0.0026061977} + rotation: {x: 0.000004058711, y: -0.008713514, z: 0.99996185, w: 0.00062257284} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftLeg + parentName: mixamorig:LeftUpLeg + position: {x: 1.0914332e-11, y: 0.8158181, z: 4.4208825e-10} + rotation: {x: -0.01263206, y: -0.0000399247, z: 0.0013578712, w: 0.9999193} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftFoot + parentName: mixamorig:LeftLeg + position: {x: -4.2300243e-12, y: 0.6898943, z: 5.53216e-11} + rotation: {x: 0.5780523, y: -0.008047839, z: 0.005178282, w: 0.8159436} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftToeBase + parentName: mixamorig:LeftFoot + position: {x: -4.5480633e-11, y: 0.20928061, z: -0.0000000028510687} + rotation: {x: 0.16457075, y: -0.0015851569, z: -0.009500289, w: 0.9863183} + scale: {x: 1, y: 1, z: 1} + - name: mixamorig:LeftToe_End + parentName: mixamorig:LeftToeBase + position: {x: -3.9693305e-12, y: 0.0816462, z: -6.7363636e-11} + rotation: {x: 0, y: -0, z: -0, w: 1} + scale: {x: 1, y: 1, z: 1} armTwist: 0.5 foreArmTwist: 0.5 upperLegTwist: 0.5 legTwist: 0.5 - armStretch: 0.05 + armStretch: 1 legStretch: 0.05 feetSpacing: 0 - globalScale: 1 + globalScale: 0.17 rootMotionBoneName: mixamorig:Hips hasTranslationDoF: 0 - hasExtraRoot: 0 + hasExtraRoot: 1 skeletonHasParents: 1 lastHumanDescriptionAvatarSource: {instanceID: 0} autoGenerateAvatarMappingIfUnspecified: 1 - animationType: 2 + animationType: 3 humanoidOversampling: 1 avatarSetup: 1 addHumanoidExtraRootOnlyWhenUsingAvatar: 1 diff --git a/Assets/Prefab/Player.prefab b/Assets/Prefab/Player.prefab index 2f1c41d..3243159 100644 --- a/Assets/Prefab/Player.prefab +++ b/Assets/Prefab/Player.prefab @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e188a9bf91bce350d5779b030c85071df864839000f074cd65c5502c8afefc13 -size 21839 +oid sha256:337ddc7093a391c1d297229a3c3474c996c985172bdd240c0cfac403df17808d +size 37002 diff --git a/Assets/Scenes/BoatTest.unity b/Assets/Scenes/BoatTest.unity index c049596..3c1fcc8 100644 --- a/Assets/Scenes/BoatTest.unity +++ b/Assets/Scenes/BoatTest.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d0ec36d9b37bf7a9f684f834da6ee33b8b7a939bdbe265adf551380dfce347f -size 73717 +oid sha256:767b196bdccb8e20c85153750ac068d1ad5d7be93742a9ca924c277472ae3adc +size 54197 diff --git a/Assets/Scenes/Development/CharacterControllerTest.unity b/Assets/Scenes/Development/CharacterControllerTest.unity index c8f91d9..cdfe1a4 100644 --- a/Assets/Scenes/Development/CharacterControllerTest.unity +++ b/Assets/Scenes/Development/CharacterControllerTest.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24894f68749013207500f5f502e5ef2753c5be9a2b2b74009445948336e95510 -size 8513 +oid sha256:2d6294891dac118a20ec2af8831645ae9a5c3b0c5ed42bf2c3a242b0fc277afa +size 13380 diff --git a/Assets/Scripts/Player/HandController.cs b/Assets/Scripts/Player/HandController.cs index c2d130f..74b6352 100644 --- a/Assets/Scripts/Player/HandController.cs +++ b/Assets/Scripts/Player/HandController.cs @@ -34,7 +34,14 @@ public class HandController : MonoBehaviour private float m_armSpeed = 0.5f; [SerializeField, BoxGroup("Settings")] - private Vector2 m_startInput = new Vector2(0, 1); + private Vector2 m_startInput = new Vector2(0, 1); + + [SerializeField] + private Vector3 m_IKOffset = new Vector3(0, 0, 0.05f); + + [SerializeField] + private Quaternion m_IKRotationOffset; + [SerializeField, BoxGroup("Input")] private InputActionProperty m_inputAxis; @@ -100,6 +107,15 @@ public class HandController : MonoBehaviour //UpdateHand(m_desiredInput); } + public Vector3 GetIKPosition() + { + return transform.position + transform.TransformDirection(m_IKOffset); + } + + public Quaternion GetIKRotation() + { + return m_oar.transform.rotation * m_IKRotationOffset; + } #endregion MonoBehaviour Functions #region Class Functionality diff --git a/Assets/Scripts/Player/IkController.cs b/Assets/Scripts/Player/IkController.cs new file mode 100644 index 0000000..ebe2dc9 --- /dev/null +++ b/Assets/Scripts/Player/IkController.cs @@ -0,0 +1,99 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using NaughtyAttributes; + + +/// +/// +/// +public class IkController : MonoBehaviour +{ + + #region Inspector Fields + + [SerializeField, BoxGroup("References")] + private HandController m_leftHandTarget, m_rightHandTarget; + + [SerializeField, BoxGroup("References")] + private Animator m_animator; + + [SerializeField, BoxGroup("Settings"),Range(0,1)] + public float IKWeight = 1; + + #endregion Inspector Fields + + #region Private Fields + + #endregion Private Fields + + #region Getters + + #endregion Getters + + + + #region MonoBehaviour Functions + /// + /// OnEnable is called when the object becomes enabled and active. + /// + private void OnEnable() + { + + } + + /// + /// OnDisable is called when the behaviour becomes disabled. + /// + private void OnDisable() + { + + } + + /// + /// Update is called once per frame + /// + private void Update() + { + + } + + //a callback for calculating IK + void OnAnimatorIK() + { + if (m_animator) + { + + m_animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1); + m_animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, 1); + + m_animator.SetIKPosition(AvatarIKGoal.LeftHand, m_leftHandTarget.GetIKPosition()); + m_animator.SetIKRotation(AvatarIKGoal.LeftHand, m_leftHandTarget.GetIKRotation()); + + + m_animator.SetIKPositionWeight(AvatarIKGoal.RightHand, 1); + m_animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 1); + + m_animator.SetIKPosition(AvatarIKGoal.RightHand, m_rightHandTarget.GetIKPosition()); + m_animator.SetIKRotation(AvatarIKGoal.RightHand, m_rightHandTarget.GetIKRotation()); + + } + } + + #endregion MonoBehaviour Functions + + #region Class Functionality + + #endregion Class Functionality + + #region Editor Functions + /// + /// Called when the Component is created or Reset from the Inspector + /// + private void Reset() + { + //useful for finding components on creation + } + #endregion Editor Functions + +} \ No newline at end of file diff --git a/Assets/Scripts/Player/IkController.cs.meta b/Assets/Scripts/Player/IkController.cs.meta new file mode 100644 index 0000000..4aceba9 --- /dev/null +++ b/Assets/Scripts/Player/IkController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7fd2ddbd56d94e64faeb514279a73f43 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Utility.meta b/Assets/Scripts/Utility.meta similarity index 100% rename from Assets/Scenes/Utility.meta rename to Assets/Scripts/Utility.meta diff --git a/Assets/Scenes/Utility/CopyTransform.cs b/Assets/Scripts/Utility/CopyTransform.cs similarity index 100% rename from Assets/Scenes/Utility/CopyTransform.cs rename to Assets/Scripts/Utility/CopyTransform.cs diff --git a/Assets/Scenes/Utility/CopyTransform.cs.meta b/Assets/Scripts/Utility/CopyTransform.cs.meta similarity index 100% rename from Assets/Scenes/Utility/CopyTransform.cs.meta rename to Assets/Scripts/Utility/CopyTransform.cs.meta diff --git a/ProjectSettings/ShaderGraphSettings.asset b/ProjectSettings/ShaderGraphSettings.asset index dd09337..0f02c68 100644 --- a/ProjectSettings/ShaderGraphSettings.asset +++ b/ProjectSettings/ShaderGraphSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:16a92b7409c2b1f39a3a4c3b49ec6c6ab3a641e55eaaa8f47101026758e3339c -size 463 +oid sha256:dfb3ee524e88ea7a9f6189a0eca526f4603394cb6039c7b0819d634cdaeaa2be +size 885