diff --git a/Assets/Player.meta b/Assets/Player.meta index 1cf492f..0fd2ad6 100644 --- a/Assets/Player.meta +++ b/Assets/Player.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: dce5b93d5dab8754ba1e190d835dc63c +guid: e3074f8f2c7f63f4980f3b22cab464f5 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Player/Graphs.meta b/Assets/Player/Graphs.meta index 301a496..ecec0a8 100644 --- a/Assets/Player/Graphs.meta +++ b/Assets/Player/Graphs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: fb87f5f35d1ed2644b3e02293ec71bc0 +guid: 60be2281fe1b6434183f4b2396cc7cd0 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Player/Graphs/GrappleAimBT.asset b/Assets/Player/Graphs/GrappleAimBT.asset index a8d0ef2..fad08de 100644 --- a/Assets/Player/Graphs/GrappleAimBT.asset +++ b/Assets/Player/Graphs/GrappleAimBT.asset @@ -12,28 +12,33 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a686a47eee2fa44cb0a34b5d86e4d5e, type: 3} m_Name: GrappleAimBT m_EditorClassIdentifier: - _serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"_position":{"x":732.5245,"y":286.5939},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"0"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-154.0485,"y":519.9156},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"1"},{"_action":{"fieldOfView":{"label":"FOV","value":60.0,"changeValue":1},"orbitPositionDamping":{"label":"Position - Damping","newValue":{"x":0.2,"z":0.2},"changeX":1,"changeZ":1},"orbitFollowTop":{"label":"Top","changeHeight":1,"height":2.0,"changeRadius":1,"radius":2.0},"orbitFollowCenter":{"label":"Center","changeHeight":1,"height":1.5,"changeRadius":1,"radius":2.4},"orbitFollowBottom":{"label":"Bottom","changeHeight":1,"height":0.2,"changeRadius":1,"radius":0.8},"cameraOffset":{"label":"Screen + _serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"_position":{"x":732.5245,"y":286.5939},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"0"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-154.0485,"y":519.9156},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"1"},{"_action":{"fieldOfView":{"label":"FOV","value":{"_value":60.0},"changeValue":1},"orbitPositionDamping":{"label":"Position + Damping","newValue":{"x":0.2,"z":0.2},"changeX":1,"changeZ":1},"orbitFollowTop":{"label":"Top","changeHeight":1,"height":2.0,"changeRadius":1,"radius":2.0},"orbitFollowCenter":{"label":"Center","changeHeight":1,"height":1.5,"changeRadius":1,"radius":2.4},"orbitFollowBottom":{"label":"Bottom","changeHeight":1,"height":0.2,"changeRadius":1,"radius":0.8},"axisLookXGain":{"label":"Look + Orbit X Gain","value":{}},"axisLookYGain":{"label":"Look Orbit Y Gain","value":{}},"cameraOffset":{"label":"Screen Position","newValue":{"x":2.0,"y":0.5,"z":-1.0},"changeX":1,"changeY":1,"changeZ":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":-139.3679,"y":620.3029},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"2"},{"_action":{"actions":[{"eventName":{"_value":"Grapple Aimed"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent"},{"valueA":{"_name":"facingDirection","_targetVariableID":"c4e68b75-5129-428c-8177-abb7b38986f5"},"valueB":{"_value":2},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[PlayerFacingDirection, - Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":91.00002,"y":524.9998},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"3"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":336.0,"y":511.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"4"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":568.0,"y":515.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"5"},{"policy":1,"dynamic":true,"_position":{"x":749.7742,"y":517.9701},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"6"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":247.0,"y":763.0},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"7"},{"_condition":{"castType":{"_value":4},"length":{"_value":80.0},"direction":{"_value":{"z":1.0}},"offset":{},"ignoreLayers":{"_value":{"value":8}},"width":{"_value":3.0},"size":{},"rotation":{},"drawGizmos":true,"outputHit":{"_name":"_hit"},"overrideAgent":{"_type":"UnityEngine.Transform","_name":"camera","_targetVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba"},"$type":"Reset.CheckGenericObserver"},"_position":{"x":209.0,"y":870.0},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"8"},{"_action":{"boolVariable":{"_name":"_castHit"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":127.0,"y":975.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"9"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":320.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"10"},{"_position":{"x":841.0,"y":848.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"11"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":540.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"12"},{"_condition":{"valueA":{"_name":"_castHit"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":569.0,"y":1078.0},"$type":"NodeCanvas.BehaviourTrees.ConditionalEvaluator","$id":"13"},{"_action":{"actions":[{"raycastHit":{"_name":"_hit"},"transform":{},"collider":{},"gameObject":{},"distance":{},"normal":{},"point":{"_name":"_hitPoint"},"$type":"NodeCanvas.Tasks.Actions.DecomposeRaycastHit"},{"objectName":{"_value":"Hit - Point"},"position":{"_name":"_hitPoint"},"rotation":{},"saveAs":{"_name":"_hitPointObject"},"$type":"NodeCanvas.Tasks.Actions.CreateGameObject"},{"relatedObject":{"_name":"_hitPointObject"},"weight":{"_value":0.15},"isMain":{"_value":true},"$type":"NodeCanvas.Tasks.Actions.UpdateObjectCameraTracking"}],"$type":"NodeCanvas.Framework.ActionList"},"_tag":"","_position":{"x":362.2634,"y":1221.254},"_comment":"","$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"14"},{"_position":{"x":852.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"15"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":799.0,"y":1035.0},"$type":"NodeCanvas.BehaviourTrees.Interruptor","$id":"16"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":902.6089,"y":1145.236},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"17"},{"_position":{"x":912.0,"y":1202.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"18"},{"_action":{"enableXAxis":{"label":"Input - Axis X Enabled","changeValue":1},"enableYAxis":{"label":"Input Axis Y Enabled","changeValue":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":700.5458,"y":1355.854},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"19"},{"_action":{"actions":[{"actionName":{"_value":"Look"},"outputTo":{"_name":"_lookDir"},"$type":"NodeCanvas.Tasks.Actions.CheckInputValue`1[[UnityEngine.Vector2, - UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},{"targetVector":{"_name":"_lookDir"},"x":{"_name":""},"y":{"_name":"_lookDirY"},"z":{"_name":""},"$type":"NodeCanvas.Tasks.Actions.DecomposeVector"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":903.6424,"y":1356.633},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"20"},{"_condition":{"valueA":{"_name":"_lookDirY"},"checkType":1,"valueB":{"_value":0.5},"differenceThreshold":0.1,"$type":"NodeCanvas.Tasks.Conditions.CheckFloat"},"_position":{"x":1186.228,"y":1367.689},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"21"},{"_action":{"actions":[{"orbitTargetOffset":{"label":"Target - Offset","newValue":{"y":-0.5},"changeY":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},{"boolVariable":{"_name":"_launch"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":1068.955,"y":1506.523},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"22"},{"_action":{"actions":[{"orbitTargetOffset":{"label":"Target + Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":91.00002,"y":524.9998},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"3"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":334.9322,"y":510.9999},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"4"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":568.0,"y":515.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"5"},{"policy":1,"dynamic":true,"_position":{"x":749.7742,"y":517.9701},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"6"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":247.0,"y":763.0},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"7"},{"_condition":{"castType":{"_value":4},"length":{"_value":80.0},"direction":{"_value":{"z":1.0}},"offset":{},"ignoreLayers":{"_value":{"value":8}},"width":{"_value":3.0},"size":{},"rotation":{},"drawGizmos":true,"outputHit":{"_name":"_hit"},"overrideAgent":{"_type":"UnityEngine.Transform","_name":"camera","_targetVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba"},"$type":"Reset.CheckGenericObserver"},"_position":{"x":207.9322,"y":869.9999},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"8"},{"_action":{"boolVariable":{"_name":"_castHit"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":125.8861,"y":975.0001},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"9"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":320.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"10"},{"_position":{"x":841.0,"y":848.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"11"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":540.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"12"},{"_condition":{"valueA":{"_name":"_castHit"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":569.0,"y":1078.0},"$type":"NodeCanvas.BehaviourTrees.ConditionalEvaluator","$id":"13"},{"_action":{"actions":[{"raycastHit":{"_name":"_hit"},"transform":{},"collider":{},"gameObject":{},"distance":{},"normal":{},"point":{"_name":"_hitPoint"},"$type":"NodeCanvas.Tasks.Actions.DecomposeRaycastHit"},{"objectName":{"_value":"Hit + Point"},"position":{"_name":"_hitPoint"},"rotation":{},"saveAs":{"_name":"_hitPointObject"},"$type":"NodeCanvas.Tasks.Actions.CreateGameObject"},{"relatedObject":{"_name":"_hitPointObject"},"weight":{"_value":0.15},"isMain":{"_value":true},"$type":"NodeCanvas.Tasks.Actions.UpdateObjectCameraTracking"}],"$type":"NodeCanvas.Framework.ActionList"},"_tag":"","_position":{"x":354.7888,"y":1223.39},"_comment":"","$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"14"},{"_position":{"x":852.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"15"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":799.0,"y":1035.0},"$type":"NodeCanvas.BehaviourTrees.Interruptor","$id":"16"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":902.6089,"y":1145.236},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"17"},{"_position":{"x":912.0,"y":1202.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"18"},{"_action":{"fieldOfView":{"label":"FOV","value":{}},"enableXAxis":{"label":"Input + Axis X Enabled","changeValue":1},"enableYAxis":{"label":"Input Axis Y Enabled","changeValue":1},"axisLookXGain":{"label":"Look + Orbit X Gain","value":{}},"axisLookYGain":{"label":"Look Orbit Y Gain","value":{}},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":700.5458,"y":1355.854},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"19"},{"_action":{"actions":[{"actionName":{"_value":"Look"},"outputTo":{"_name":"_lookDir"},"$type":"NodeCanvas.Tasks.Actions.CheckInputValue`1[[UnityEngine.Vector2, + UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},{"targetVector":{"_name":"_lookDir"},"x":{"_name":""},"y":{"_name":"_lookDirY"},"z":{"_name":""},"$type":"NodeCanvas.Tasks.Actions.DecomposeVector"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":902.5284,"y":1356.633},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"20"},{"_condition":{"valueA":{"_name":"_lookDirY"},"checkType":1,"valueB":{"_value":0.5},"differenceThreshold":0.1,"$type":"NodeCanvas.Tasks.Conditions.CheckFloat"},"_position":{"x":1186.228,"y":1367.689},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"21"},{"_action":{"actions":[{"fieldOfView":{"label":"FOV","value":{}},"orbitTargetOffset":{"label":"Target + Offset","newValue":{"y":-0.5},"changeY":1},"axisLookXGain":{"label":"Look Orbit + X Gain","value":{}},"axisLookYGain":{"label":"Look Orbit Y Gain","value":{}},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},{"boolVariable":{"_name":"_launch"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":1068.955,"y":1506.523},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"22"},{"_action":{"actions":[{"fieldOfView":{"label":"FOV","value":{}},"orbitTargetOffset":{"label":"Target Offset","changeY":2},"enableXAxis":{"label":"Input Axis X Enabled"},"enableYAxis":{"label":"Input - Axis Y Enabled"},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},{"boolVariable":{"_name":"_launch"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":1276.972,"y":1497.002},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"23"},{"_action":{"eventName":{"_value":"Grapple - Confirmed"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent"},"_position":{"x":1059.947,"y":979.5414},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"24"},{"policy":1,"_position":{"x":921.0059,"y":510.0208},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"25"},{"_condition":{"conditions":[{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"valueA":{"_name":"_castHit"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"}],"$type":"NodeCanvas.Framework.ConditionList"},"_position":{"x":926.381,"y":667.2095},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"26"},{"_action":{"log":{"_value":"Cancelled"},"secondsToRun":0.0,"$type":"NodeCanvas.Tasks.Actions.DebugLogText"},"_position":{"x":1007.394,"y":805.2429},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"27"},{"_action":{"actions":[{"fieldOfView":{"label":"FOV","changeValue":2},"orbitTargetOffset":{"label":"Target + Axis Y Enabled"},"axisLookXGain":{"label":"Look Orbit X Gain","value":{}},"axisLookYGain":{"label":"Look + Orbit Y Gain","value":{}},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},{"boolVariable":{"_name":"_launch"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":1276.972,"y":1497.002},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"23"},{"_action":{"eventName":{"_value":"Grapple + Confirmed"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent"},"_position":{"x":1059.947,"y":979.5414},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"24"},{"policy":1,"_position":{"x":921.0059,"y":510.0208},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"25"},{"_condition":{"conditions":[{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"valueA":{"_name":"_castHit"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"}],"$type":"NodeCanvas.Framework.ConditionList"},"_position":{"x":926.381,"y":667.2095},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"26"},{"_action":{"log":{"_value":"Cancelled"},"secondsToRun":0.0,"$type":"NodeCanvas.Tasks.Actions.DebugLogText"},"_position":{"x":1007.394,"y":805.2429},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"27"},{"_action":{"actions":[{"fieldOfView":{"label":"FOV","value":{},"changeValue":2},"orbitTargetOffset":{"label":"Target Offset","changeY":2},"orbitFollowTop":{"label":"Top","changeHeight":2,"changeRadius":2},"orbitFollowCenter":{"label":"Center","changeHeight":2,"changeRadius":2},"orbitFollowBottom":{"label":"Bottom","changeHeight":2,"changeRadius":2},"enableXAxis":{"label":"Input Axis X Enabled","value":true,"changeValue":2},"enableYAxis":{"label":"Input Axis - Y Enabled","value":true,"changeValue":2},"screenPosition":{"label":"Screen Position","changeX":2,"changeY":2},"cameraOffset":{"label":"Screen - Position","changeX":2,"changeY":2,"changeZ":2},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},{"valueA":{"_name":"_observerHit"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[UnityEngine.RaycastHit, + Y Enabled","value":true,"changeValue":2},"axisLookXGain":{"label":"Look Orbit + X Gain","value":{}},"axisLookYGain":{"label":"Look Orbit Y Gain","value":{}},"screenPosition":{"label":"Screen + Position","changeX":2,"changeY":2},"cameraOffset":{"label":"Screen Position","changeX":2,"changeY":2,"changeZ":2},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},{"valueA":{"_name":"_observerHit"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[UnityEngine.RaycastHit, UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},{"relatedObject":{"_name":"_hitPointObject"},"action":1,"weight":{"_value":0.15},"isMain":{"_value":true},"$type":"NodeCanvas.Tasks.Actions.UpdateObjectCameraTracking"},{"overrideAgent":{"_type":"UnityEngine.Transform","_name":"_hitPointObject"},"$type":"NodeCanvas.Tasks.Actions.DestroyGameObject"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":1197.492,"y":515.6263},"_comment":"Clean up and resetting","$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"28"},{"_condition":{"valueA":{"_name":"_launch"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":1549.0,"y":527.0},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"29"},{"_action":{"eventName":{"_value":"Grapple Launch"},"eventValue":{"_name":"_hitPoint"},"delay":{},"sendGlobal":true,"$type":"NodeCanvas.Tasks.Actions.SendEvent`1[[UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"_position":{"x":1374.0,"y":759.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"30"},{"_action":{"eventName":{"_value":"Grapple Pull"},"eventValue":{"_name":"_hitPoint"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent`1[[UnityEngine.Vector3, - UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"_position":{"x":1672.0,"y":756.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"31"},{"failureRemap":1,"_position":{"x":400.0,"y":1531.0},"$type":"NodeCanvas.BehaviourTrees.Remapper","$id":"32"},{"_condition":{"conditions":[{"valueA":{"_name":"_castHit"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"_isDisabled":true,"$type":"NodeCanvas.Tasks.Conditions.CheckInput"}],"$type":"NodeCanvas.Framework.ConditionList"},"_position":{"x":360.6637,"y":1617.808},"$type":"NodeCanvas.BehaviourTrees.Interruptor","$id":"33"},{"monitorMode":1,"_position":{"x":-312.8632,"y":1265.204},"$type":"NodeCanvas.BehaviourTrees.Monitor","$id":"34"},{"_position":{"x":-309.8632,"y":1368.204},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"35"},{"_position":{"x":-307.8632,"y":1422.204},"$type":"NodeCanvas.BehaviourTrees.Selector","$id":"36"},{"_condition":{"castType":{"_value":4},"length":{"_value":20.0},"direction":{"_value":{"z":1.0}},"offset":{},"ignoreLayers":{"_value":{"value":8}},"width":{"_value":3.0},"size":{},"rotation":{},"drawGizmos":true,"outputHit":{},"overrideAgent":{"_type":"UnityEngine.Transform","_name":"camera","_targetVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba"},"$type":"Reset.CheckGenericObserver"},"_position":{"x":-620.8632,"y":1503.204},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"37"},{"_position":{"x":-659.8632,"y":1633.204},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"38"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-914.8632,"y":1736.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"39"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-726.2145,"y":1735.09},"$type":"NodeCanvas.BehaviourTrees.ConditionNode","$id":"40"},{"_action":{"boolVariable":{"_name":"_castHit"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-505.8632,"y":1739.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"41"},{"policy":1,"dynamic":true,"_position":{"x":-305.8632,"y":1532.204},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"42"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":-311.8632,"y":1674.204},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"43"},{"_action":{"actionName":{"_value":"Move"},"outputTo":{"_name":"_test"},"$type":"NodeCanvas.Tasks.Actions.CheckInputValue`1[[UnityEngine.Vector2, + UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"_position":{"x":1672.0,"y":756.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"31"},{"failureRemap":1,"_position":{"x":398.8861,"y":1531.0},"$type":"NodeCanvas.BehaviourTrees.Remapper","$id":"32"},{"_condition":{"conditions":[{"valueA":{"_name":"_castHit"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"_isDisabled":true,"$type":"NodeCanvas.Tasks.Conditions.CheckInput"}],"$type":"NodeCanvas.Framework.ConditionList"},"_position":{"x":360.6636,"y":1618.922},"$type":"NodeCanvas.BehaviourTrees.Interruptor","$id":"33"},{"monitorMode":1,"_position":{"x":-312.8632,"y":1265.204},"$type":"NodeCanvas.BehaviourTrees.Monitor","$id":"34"},{"_position":{"x":-309.8632,"y":1368.204},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"35"},{"_position":{"x":-307.8632,"y":1422.204},"$type":"NodeCanvas.BehaviourTrees.Selector","$id":"36"},{"_condition":{"castType":{"_value":4},"length":{"_value":20.0},"direction":{"_value":{"z":1.0}},"offset":{},"ignoreLayers":{"_value":{"value":8}},"width":{"_value":3.0},"size":{},"rotation":{},"drawGizmos":true,"outputHit":{},"overrideAgent":{"_type":"UnityEngine.Transform","_name":"camera","_targetVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba"},"$type":"Reset.CheckGenericObserver"},"_position":{"x":-620.8632,"y":1503.204},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"37"},{"_position":{"x":-659.8632,"y":1633.204},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"38"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-914.8632,"y":1736.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"39"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-726.2145,"y":1735.09},"$type":"NodeCanvas.BehaviourTrees.ConditionNode","$id":"40"},{"_action":{"boolVariable":{"_name":"_castHit"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-505.8632,"y":1739.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"41"},{"policy":1,"dynamic":true,"_position":{"x":-305.8632,"y":1532.204},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"42"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":-311.8632,"y":1674.204},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"43"},{"_action":{"actionName":{"_value":"Move"},"outputTo":{"_name":"_test"},"$type":"NodeCanvas.Tasks.Actions.CheckInputValue`1[[UnityEngine.Vector2, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"_position":{"x":-326.9252,"y":1793.079},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"44"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-159.1308,"y":1664.066},"$type":"NodeCanvas.BehaviourTrees.ConditionNode","$id":"45"}],"connections":[{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"25"},"_isDisabled":true,"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"28"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"29"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"7"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"11"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"7"},"_targetNode":{"$ref":"8"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"8"},"_targetNode":{"$ref":"9"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"8"},"_targetNode":{"$ref":"10"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"11"},"_targetNode":{"$ref":"12"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"11"},"_targetNode":{"$ref":"15"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"11"},"_targetNode":{"$ref":"24"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"12"},"_targetNode":{"$ref":"13"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"13"},"_targetNode":{"$ref":"14"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"15"},"_targetNode":{"$ref":"16"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"16"},"_targetNode":{"$ref":"17"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"17"},"_targetNode":{"$ref":"18"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"18"},"_targetNode":{"$ref":"19"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"18"},"_targetNode":{"$ref":"20"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"18"},"_targetNode":{"$ref":"21"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"21"},"_targetNode":{"$ref":"22"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"21"},"_targetNode":{"$ref":"23"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"25"},"_targetNode":{"$ref":"26"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"26"},"_targetNode":{"$ref":"27"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"29"},"_targetNode":{"$ref":"30"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"29"},"_targetNode":{"$ref":"31"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"32"},"_targetNode":{"$ref":"33"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"34"},"_targetNode":{"$ref":"35"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"35"},"_targetNode":{"$ref":"36"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"36"},"_targetNode":{"$ref":"37"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"36"},"_targetNode":{"$ref":"42"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"37"},"_targetNode":{"$ref":"38"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"38"},"_targetNode":{"$ref":"39"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"38"},"_targetNode":{"$ref":"40"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"38"},"_targetNode":{"$ref":"41"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"42"},"_targetNode":{"$ref":"43"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"42"},"_targetNode":{"$ref":"45"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"43"},"_targetNode":{"$ref":"44"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"camera":{"_name":"camera","_id":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Transform, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"facingDirection":{"_name":"facingDirection","_id":"c4e68b75-5129-428c-8177-abb7b38986f5","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[PlayerFacingDirection, Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}' @@ -42,7 +47,7 @@ MonoBehaviour: _version: 3.31 _category: _comments: - _translation: {x: 180, y: -268} - _zoomFactor: 0.9998386 + _translation: {x: 126, y: -14} + _zoomFactor: 0.89776397 _haltSerialization: 0 _externalSerializationFile: {fileID: 0} diff --git a/Assets/Player/Graphs/GrappleAimBT.asset.meta b/Assets/Player/Graphs/GrappleAimBT.asset.meta index f41ab03..ce063e1 100644 --- a/Assets/Player/Graphs/GrappleAimBT.asset.meta +++ b/Assets/Player/Graphs/GrappleAimBT.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c2ae6811bd56a6245a6ab9ec1b0503ae +guid: beebc26815c062d4c80362506bb8ad84 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/Player/Graphs/GroundedCheckBT.asset b/Assets/Player/Graphs/GroundedCheckBT.asset index 85d3220..2e5b494 100644 --- a/Assets/Player/Graphs/GroundedCheckBT.asset +++ b/Assets/Player/Graphs/GroundedCheckBT.asset @@ -18,7 +18,7 @@ MonoBehaviour: _version: 3.31 _category: _comments: - _translation: {x: 442.93335, y: -225.00038} + _translation: {x: 296, y: -43} _zoomFactor: 1 _haltSerialization: 0 _externalSerializationFile: {fileID: 0} diff --git a/Assets/Player/Graphs/GroundedCheckBT.asset.meta b/Assets/Player/Graphs/GroundedCheckBT.asset.meta index f458e15..45ce10f 100644 --- a/Assets/Player/Graphs/GroundedCheckBT.asset.meta +++ b/Assets/Player/Graphs/GroundedCheckBT.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f9aba4b029eacea44966829321f0124a +guid: 40971083372a2534babfd95df6867650 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/Player/Graphs/PlayerMovementResetTriggerBT.asset b/Assets/Player/Graphs/PlayerMovementResetTriggerBT.asset index dac27e2..e20330e 100644 --- a/Assets/Player/Graphs/PlayerMovementResetTriggerBT.asset +++ b/Assets/Player/Graphs/PlayerMovementResetTriggerBT.asset @@ -26,7 +26,7 @@ MonoBehaviour: _version: 3.31 _category: _comments: - _translation: {x: -82, y: -349} + _translation: {x: 92, y: 23} _zoomFactor: 1 _haltSerialization: 0 _externalSerializationFile: {fileID: 0} diff --git a/Assets/Player/Input.meta b/Assets/Player/Input.meta index 0b30dff..0d98586 100644 --- a/Assets/Player/Input.meta +++ b/Assets/Player/Input.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 58a4147d2b9083846957575fc3b16667 +guid: 9c8da50e4d543dc438c126a404033048 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Player/Input/InputSystem.inputsettings.asset.meta b/Assets/Player/Input/InputSystem.inputsettings.asset.meta index a0e221f..6b4675e 100644 --- a/Assets/Player/Input/InputSystem.inputsettings.asset.meta +++ b/Assets/Player/Input/InputSystem.inputsettings.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8e19eb4aa4fac2a409e792d0d3e5f944 +guid: e4ca318d34698fe41ba99a765e54e4c2 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/Player/Input/PlayerInputs.inputactions.meta b/Assets/Player/Input/PlayerInputs.inputactions.meta index 9d8d3b8..a3a4725 100644 --- a/Assets/Player/Input/PlayerInputs.inputactions.meta +++ b/Assets/Player/Input/PlayerInputs.inputactions.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 652c4cc5d47d8de45a54e21abc9d8d1a +guid: 94c7611bb3f64b248940847af54844cf ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/Assets/Scenes/GrappleTesting.unity b/Assets/Scenes/GrappleTesting.unity index eb7d2e7..a2f859b 100644 --- a/Assets/Scenes/GrappleTesting.unity +++ b/Assets/Scenes/GrappleTesting.unity @@ -50145,7 +50145,7 @@ MonoBehaviour: Owner: {fileID: 402424907} Enabled: 1 Input: - InputAction: {fileID: 6185001796860367008, guid: 652c4cc5d47d8de45a54e21abc9d8d1a, type: 3} + InputAction: {fileID: 6185001796860367008, guid: 94c7611bb3f64b248940847af54844cf, type: 3} Gain: 200 LegacyInput: LegacyGain: 200 @@ -50158,7 +50158,7 @@ MonoBehaviour: Owner: {fileID: 402424907} Enabled: 1 Input: - InputAction: {fileID: 6185001796860367008, guid: 652c4cc5d47d8de45a54e21abc9d8d1a, type: 3} + InputAction: {fileID: 6185001796860367008, guid: 94c7611bb3f64b248940847af54844cf, type: 3} Gain: -100 LegacyInput: LegacyGain: -200 @@ -99261,6 +99261,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: outputMoveDirection: {x: 0, y: 0, z: 0} + additionalMoveDirection: {x: 0, y: 0, z: 0} + gravitySmooth: 0 data: accelerationSmoothing: 4 deaccelerationSmoothing: 6 @@ -99273,6 +99275,7 @@ MonoBehaviour: gravityMax: 8 gravityAcceleration: 1.3 gravityScale: 1 + settingsChangeSmoothing: 6 rotateFacing: rid: 2028245219396813027 rotationSpeed: 10 @@ -99290,6 +99293,7 @@ MonoBehaviour: gravityMax: 8 gravityAcceleration: 1 gravityScale: 1 + settingsChangeSmoothing: 6 rotateFacing: rid: -2 rotationSpeed: 5 @@ -99332,7 +99336,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} m_Name: m_EditorClassIdentifier: - m_Actions: {fileID: -944628639613478452, guid: 652c4cc5d47d8de45a54e21abc9d8d1a, type: 3} + m_Actions: {fileID: -944628639613478452, guid: 94c7611bb3f64b248940847af54844cf, type: 3} m_NotificationBehavior: 0 m_UIInputModule: {fileID: 0} m_DeviceLostEvent: @@ -99503,17 +99507,18 @@ MonoBehaviour: Smoothing","value":{},"changeValue":1},"deaccelerationSmoothing":{"label":"Deacceleration Smoothing","value":{},"changeValue":1},"jumpPower":{"label":"Jump Power","value":{}},"jumpPowerDecay":{"label":"Jump Decay Speed","value":{}},"gravityPower":{"label":"Gravity Power","value":{},"changeValue":1},"gravityMax":{"label":"Gravity - Max","value":{}},"gravityAcceleration":{"label":"Gravity Acceleration Speed","value":{},"changeValue":1},"gravityScale":{"label":"Gravity - Scale","value":{}},"settingsChangeSmoothing":{"label":"Settings Change Smoothing","value":{}},"rotationSpeed":{"label":"Rotation - Speed","value":{}},"rotationSmoothing":{"label":"Rotation Smoothing","value":{}},"rotationInputBlending":{"label":"Rotation - Input Blending","value":{}},"feedNewRotation":{},"feedRelativeTo":{},"$type":"Reset.Core.ChangeMovementSettings"},{"airDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"targetLocation":{"_name":"_grappleLaunchDir"},"offset":{"_value":{"y":1.0}},"relativeRotation":{},"launchRelativeTo":{},"useRelativeForce":{"_value":true},"minimumForce":{},"maximumForce":{"_value":100.0},"forceRelativeToDistance":{"_value":4.0},"force":{},"_isDisabled":true,"$type":"NodeCanvas.Tasks.Actions.StartLaunchJump"},{"grapplePoint":{"_name":"_grappleLaunchDir"},"offset":{},"pullAccelerationSpeed":{},"pullDeaccelerationSpeed":{},"pullTimeRange":{},"pullSpeedRange":{"_value":{"x":5.0,"y":20.0}},"slowdownDistance":{"_value":40.0},"pullSpeedCurve":{"_value":{"keys":[{"time":0.006996155,"value":0.4524789,"tangentMode":0,"inTangent":0.1111637,"outTangent":0.1111637},{"time":0.2206978,"value":0.7016913,"tangentMode":0,"inTangent":0.5933766,"outTangent":0.5933766},{"time":0.4624784,"value":0.7784544,"tangentMode":0,"inTangent":0.081825,"outTangent":0.081825},{"time":1.0,"value":0.4377128,"tangentMode":0,"inTangent":-1.657803,"outTangent":-1.657803}],"preWrapMode":8,"postWrapMode":8}},"endDeaccelerationCurve":{"_value":{"keys":[{"time":0.09687042,"value":1.0,"tangentMode":136,"inTangent":0.0,"outTangent":0.0},{"time":0.9987154,"value":0.4624017,"tangentMode":136,"inTangent":0.0,"outTangent":0.0}],"preWrapMode":8,"postWrapMode":8}},"breakAtDotProduct":0.5,"$type":"NodeCanvas.Tasks.Actions.DoGrapplePull"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"foldExit":true,"_color":{"r":0.5019608,"g":1.0,"b":0.9803922,"a":1.0},"_name":"Grapple - Launch","_position":{"x":-745.9385,"y":-369.6954},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"8"},{"_onEnterList":{"executionMode":1,"actions":[]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"Operation":2,"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetInt"}]},"foldEnter":true,"foldExit":true,"_color":{"r":0.4132327,"g":0.945098,"b":0.254902,"a":1.0},"_name":"Post + Max","value":{},"changeValue":1},"gravityAcceleration":{"label":"Gravity Acceleration + Speed","value":{},"changeValue":1},"gravityScale":{"label":"Gravity Scale","value":{}},"settingsChangeSmoothing":{"label":"Settings + Change Smoothing","value":{}},"rotationSpeed":{"label":"Rotation Speed","value":{}},"rotationSmoothing":{"label":"Rotation + Smoothing","value":{}},"rotationInputBlending":{"label":"Rotation Input Blending","value":{}},"feedNewRotation":{},"feedRelativeTo":{},"$type":"Reset.Core.ChangeMovementSettings"},{"airDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"targetLocation":{"_name":"_grappleLaunchDir"},"offset":{"_value":{"y":1.0}},"relativeRotation":{},"launchRelativeTo":{},"useRelativeForce":{"_value":true},"minimumForce":{},"maximumForce":{"_value":100.0},"forceRelativeToDistance":{"_value":4.0},"force":{},"_isDisabled":true,"$type":"NodeCanvas.Tasks.Actions.StartLaunchJump"},{"grapplePoint":{"_name":"_grappleLaunchDir"},"offset":{},"pullAccelerationSpeed":{},"pullDeaccelerationSpeed":{},"pullTimeRange":{},"pullSpeedRange":{"_value":{"x":5.0,"y":20.0}},"slowdownDistance":{"_value":40.0},"pullSpeedCurve":{"_value":{"keys":[{"time":0.006996155,"value":0.4524789,"tangentMode":0,"inTangent":0.1111637,"outTangent":0.1111637},{"time":0.2206978,"value":0.7016913,"tangentMode":0,"inTangent":0.5933766,"outTangent":0.5933766},{"time":0.4624784,"value":0.7784544,"tangentMode":0,"inTangent":0.081825,"outTangent":0.081825},{"time":1.0,"value":0.4377128,"tangentMode":0,"inTangent":-1.657803,"outTangent":-1.657803}],"preWrapMode":8,"postWrapMode":8}},"endDeaccelerationCurve":{"_value":{"keys":[{"time":0.09687042,"value":1.0,"tangentMode":136,"inTangent":0.0,"outTangent":0.0},{"time":0.9987154,"value":0.4624017,"tangentMode":136,"inTangent":0.0,"outTangent":0.0}],"preWrapMode":8,"postWrapMode":8}},"breakAtDotProduct":-0.3,"$type":"NodeCanvas.Tasks.Actions.DoGrapplePull"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"foldExit":true,"_color":{"r":0.5019608,"g":1.0,"b":0.9803922,"a":1.0},"_name":"Grapple + Launch","_position":{"x":-746.9398,"y":-370.6968},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"8"},{"_onEnterList":{"executionMode":1,"actions":[]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"Operation":2,"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetInt"}]},"foldEnter":true,"foldExit":true,"_color":{"r":0.4132327,"g":0.945098,"b":0.254902,"a":1.0},"_name":"Post Grapple Jump","_position":{"x":-343.0,"y":-614.0},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"9"},{"_actionList":{"actions":[{"moveSpeed":{"label":"Move Speed","value":{}},"moveSpeedSoothing":{"label":"Move Speed Smoothing","value":{}},"airDirectionDecay":{"label":"Air Direction Decay","value":{}},"accelerationSmoothing":{"label":"Acceleration Smoothing","value":{},"changeValue":1},"deaccelerationSmoothing":{"label":"Deacceleration Smoothing","value":{},"changeValue":1},"jumpPower":{"label":"Jump Power","value":{}},"jumpPowerDecay":{"label":"Jump - Decay Speed","value":{},"changeValue":2},"gravityPower":{"label":"Gravity Power","value":{}},"gravityMax":{"label":"Gravity - Max","value":{}},"gravityAcceleration":{"label":"Gravity Acceleration Speed","value":{},"changeValue":1},"gravityScale":{"label":"Gravity + Decay Speed","value":{},"changeValue":2},"gravityPower":{"label":"Gravity Power","value":{},"changeValue":2},"gravityMax":{"label":"Gravity + Max","value":{},"changeValue":2},"gravityAcceleration":{"label":"Gravity Acceleration + Speed","value":{"_value":0.5},"changeValue":1},"gravityScale":{"label":"Gravity Scale","value":{},"changeValue":2},"settingsChangeSmoothing":{"label":"Settings Change Smoothing","value":{}},"rotationSpeed":{"label":"Rotation Speed","value":{}},"rotationSmoothing":{"label":"Rotation Smoothing","value":{}},"rotationInputBlending":{"label":"Rotation Input Blending","value":{}},"feedNewRotation":{},"feedRelativeTo":{},"$type":"Reset.Core.ChangeMovementSettings"},{"valueA":{"_name":"newAirMoveSmoothing","_targetVariableID":"9ba7a222-e29f-4ef5-8f1e-144189e5e5d3"},"valueB":{"_value":0.6},"_isDisabled":true,"$type":"NodeCanvas.Tasks.Actions.SetFloat"},{"eventName":{"_value":"Delay @@ -99684,7 +99689,7 @@ MonoBehaviour: Scale","value":{}},"settingsChangeSmoothing":{"label":"Settings Change Smoothing","value":{}},"rotationSpeed":{"label":"Rotation Speed","value":{}},"rotationSmoothing":{"label":"Rotation Smoothing","value":{}},"rotationInputBlending":{"label":"Rotation Input Blending","value":{}},"feedNewRotation":{},"feedRelativeTo":{},"$type":"Reset.Core.ChangeMovementSettings"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"_color":{"r":0.5019608,"g":1.0,"b":0.9803922,"a":1.0},"_name":"Grapple - Pull","_position":{"x":-534.6552,"y":-152.7098},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"26"},{"_subTree":{"_value":1},"_variablesMap":[{"_targetSubGraphVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba","_canWrite":true,"_type":"UnityEngine.Transform","_value":{"$content":2,"$type":"UnityEngine.Transform"}},{"_targetSubGraphVariableID":"c4e68b75-5129-428c-8177-abb7b38986f5","_canRead":true,"_canWrite":true,"_type":"PlayerFacingDirection","_name":"facingDirection","_targetVariableID":"ff039cd9-e306-4c88-84db-54cbd3708ed5"}],"_position":{"x":108.4589,"y":186.5594},"$type":"NodeCanvas.StateMachines.ConcurrentSubTree"},{"_subTree":{"_value":3},"_tag":"","_position":{"x":139.1634,"y":300.6739},"_comment":"","$type":"NodeCanvas.StateMachines.ConcurrentSubTree"},{"_conditionList":{"conditions":[{"valueA":{"_name":"myBoolean","_targetVariableID":"c3172967-7d7a-44ba-837f-55b966e121b3"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"}]},"_actionList":{"executionMode":1,"actions":[{"grapplePoint":{"_name":"_grappleLaunchDir"},"offset":{},"pullAccelerationSpeed":{},"pullDeaccelerationSpeed":{},"pullTimeRange":{},"pullSpeedRange":{"_value":{"y":50.0}},"slowdownDistance":{"_value":40.0},"pullSpeedCurve":{"_value":{"keys":[{"time":0.006996155,"value":0.4524789,"tangentMode":0,"inTangent":0.1111637,"outTangent":0.1111637},{"time":0.2206978,"value":0.7016913,"tangentMode":0,"inTangent":0.5933766,"outTangent":0.5933766},{"time":0.4624784,"value":0.7784544,"tangentMode":0,"inTangent":0.081825,"outTangent":0.081825},{"time":1.0,"value":0.4377128,"tangentMode":0,"inTangent":-1.657803,"outTangent":-1.657803}],"preWrapMode":8,"postWrapMode":8}},"endDeaccelerationCurve":{"_value":{"keys":[{"time":0.09687042,"value":1.0,"tangentMode":136,"inTangent":0.0,"outTangent":0.0},{"time":0.9987154,"value":0.4624017,"tangentMode":136,"inTangent":0.0,"outTangent":0.0}],"preWrapMode":8,"postWrapMode":8}},"$type":"NodeCanvas.Tasks.Actions.DoGrapplePull"}]},"_position":{"x":-695.7593,"y":411.6037},"$type":"NodeCanvas.StateMachines.OnFSMUpdate"},{"_conditionList":{"conditions":[]},"_actionList":{"executionMode":1,"actions":[{"targetVector":{"_name":"outputMoveDirection","_targetVariableID":"3b9833f5-870a-4182-9824-e31a9896eec2"},"x":{"_name":""},"y":{"_name":"_currentYMoveDirection"},"z":{"_name":""},"$type":"NodeCanvas.Tasks.Actions.DecomposeVector"}]},"_position":{"x":-9.357971,"y":610.3325},"$type":"NodeCanvas.StateMachines.OnFSMUpdate"},{"_onEnterList":{"executionMode":1,"actions":[]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"_color":{"r":0.4980392,"g":1.0,"b":0.9803922,"a":1.0},"_name":"Airborne + Pull","_position":{"x":-534.6552,"y":-152.7098},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"26"},{"_subTree":{"_value":1},"_variablesMap":[{"_targetSubGraphVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba","_canWrite":true,"_type":"UnityEngine.Transform","_value":{"$content":2,"$type":"UnityEngine.Transform"}},{"_targetSubGraphVariableID":"c4e68b75-5129-428c-8177-abb7b38986f5","_canWrite":true,"_type":"PlayerFacingDirection","_value":{"$content":0,"$type":"PlayerFacingDirection"}}],"_position":{"x":108.4589,"y":186.5594},"$type":"NodeCanvas.StateMachines.ConcurrentSubTree"},{"_subTree":{"_value":3},"_tag":"","_position":{"x":139.1634,"y":300.6739},"_comment":"","$type":"NodeCanvas.StateMachines.ConcurrentSubTree"},{"_conditionList":{"conditions":[{"valueA":{"_name":"myBoolean","_targetVariableID":"c3172967-7d7a-44ba-837f-55b966e121b3"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"}]},"_actionList":{"executionMode":1,"actions":[{"grapplePoint":{"_name":"_grappleLaunchDir"},"offset":{},"pullAccelerationSpeed":{},"pullDeaccelerationSpeed":{},"pullTimeRange":{},"pullSpeedRange":{"_value":{"y":50.0}},"slowdownDistance":{"_value":40.0},"pullSpeedCurve":{"_value":{"keys":[{"time":0.006996155,"value":0.4524789,"tangentMode":0,"inTangent":0.1111637,"outTangent":0.1111637},{"time":0.2206978,"value":0.7016913,"tangentMode":0,"inTangent":0.5933766,"outTangent":0.5933766},{"time":0.4624784,"value":0.7784544,"tangentMode":0,"inTangent":0.081825,"outTangent":0.081825},{"time":1.0,"value":0.4377128,"tangentMode":0,"inTangent":-1.657803,"outTangent":-1.657803}],"preWrapMode":8,"postWrapMode":8}},"endDeaccelerationCurve":{"_value":{"keys":[{"time":0.09687042,"value":1.0,"tangentMode":136,"inTangent":0.0,"outTangent":0.0},{"time":0.9987154,"value":0.4624017,"tangentMode":136,"inTangent":0.0,"outTangent":0.0}],"preWrapMode":8,"postWrapMode":8}},"$type":"NodeCanvas.Tasks.Actions.DoGrapplePull"}]},"_position":{"x":-695.7593,"y":411.6037},"$type":"NodeCanvas.StateMachines.OnFSMUpdate"},{"_conditionList":{"conditions":[]},"_actionList":{"executionMode":1,"actions":[{"targetVector":{"_name":"outputMoveDirection","_targetVariableID":"3b9833f5-870a-4182-9824-e31a9896eec2"},"x":{"_name":""},"y":{"_name":"_currentYMoveDirection"},"z":{"_name":""},"$type":"NodeCanvas.Tasks.Actions.DecomposeVector"}]},"_position":{"x":-9.357971,"y":610.3325},"$type":"NodeCanvas.StateMachines.OnFSMUpdate"},{"_onEnterList":{"executionMode":1,"actions":[]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"_color":{"r":0.4980392,"g":1.0,"b":0.9803922,"a":1.0},"_name":"Airborne Standby","_position":{"x":1509.989,"y":-548.8954},"$type":"NodeCanvas.StateMachines.SuperActionState"},{"_subTree":{"_value":4},"_position":{"x":1132.543,"y":-344.117},"$type":"NodeCanvas.StateMachines.ConcurrentSubTree"}],"connections":[{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Jump"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"21"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"eventName":{"_value":"Grapple Launch"},"saveEventValue":{"_name":"_grappleLaunchDir"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent`1[[UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"7"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"eventName":{"_value":"Grapple @@ -99713,17 +99718,17 @@ MonoBehaviour: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}}}}' _boundGraphObjectReferences: - {fileID: 0} - - {fileID: 11400000, guid: c2ae6811bd56a6245a6ab9ec1b0503ae, type: 2} - - {fileID: 330585546} - - {fileID: 11400000, guid: f9aba4b029eacea44966829321f0124a, type: 2} + - {fileID: 11400000, guid: beebc26815c062d4c80362506bb8ad84, type: 2} + - {fileID: 402424906} + - {fileID: 11400000, guid: 40971083372a2534babfd95df6867650, type: 2} - {fileID: 11400000, guid: 26340c3b8bba95c4396860ccfc2cd444, type: 2} - {fileID: 275656777} _boundGraphSource: _version: 3.31 _category: _comments: - _translation: {x: 1050, y: 569} - _zoomFactor: 0.99864507 + _translation: {x: 235, y: 381} + _zoomFactor: 1 _firstActivation: 0 _enableAction: 0 _disableAction: 0 diff --git a/Assets/Scripts/Core/Graph Tasks/DoGrapplePull.cs b/Assets/Scripts/Core/Graph Tasks/DoGrapplePull.cs index f9dba26..5159807 100644 --- a/Assets/Scripts/Core/Graph Tasks/DoGrapplePull.cs +++ b/Assets/Scripts/Core/Graph Tasks/DoGrapplePull.cs @@ -40,6 +40,7 @@ namespace NodeCanvas.Tasks.Actions { private Vector3 originalDirection; public float breakAtDistance; + [Tooltip("The dot product between the current direction to the grapple point, and the direction to the grapple point when started. Starts at 1 and gradually gets closer to -1, with 0 being 90 degrees perpendicular.")] public float breakAtDotProduct; private float currentSpeed; @@ -53,6 +54,8 @@ namespace NodeCanvas.Tasks.Actions { private float gizmoVertValue; private Transform camera; + + Vector3 smoothedSwingDirection; private float referenceSpeed; @@ -62,11 +65,6 @@ namespace NodeCanvas.Tasks.Actions { //Use for initialization. This is called only once in the lifetime of the task. //Return null if init was successfull. Return an error string otherwise protected override string OnInit(){ - DebugOverlayDrawer.AddOnOverlay("Grapple", "Composite Swing Direction", Vector3.zero); - DebugOverlayDrawer.AddOnOverlay("Grapple", "Target Swing Direction", Vector3.zero); - DebugOverlayDrawer.AddOnOverlay("Grapple", "Smoothed Input", Vector3.zero); - - return null; @@ -84,74 +82,110 @@ namespace NodeCanvas.Tasks.Actions { // Get the current move direction velocityOnStart = agent.outputMoveDirection; + // For setting finalDirection's initial value, first compose the swing variables one-time + Vector3 velocityWhenMoving = CalculateSwingDirections(Vector3.Distance(agent.transform.position, grapplePoint.value), directionOnStart); + // Lerp the initial direction more towards the point of the grapple and less towards current momentum if not moving fast - finalDirection = Vector3.Lerp(velocityOnStart, directionOnStart, velocityOnStart.magnitude / 10f); + finalDirection = Vector3.Lerp(velocityOnStart, velocityWhenMoving, velocityOnStart.magnitude / 2f); // This isn't working + + // Set the intial swing direction to the same thing, so it starts swinging withing snapping on start + smoothedSwingDirection = finalDirection.Flatten(null, .4f, null); startTime = Time.time; currentSpeed = pullSpeedCurve.value[0].value * pullSpeedRange.value.y; - smoothedInput = agent.GetComponent().velocity.normalized.Flatten(null, 0f, 0f); + // smoothedInput = agent.GetComponent().velocity.normalized.Flatten(null, 0f, 0f); + smoothedInput = Vector3.zero; } //Called once per frame while the action is active. protected override void OnUpdate(){ - // Get direction to the point + agent.outputMoveDirection = Vector3.MoveTowards(agent.outputMoveDirection, Vector3.zero, .5f); + + // Basic variables, direction to point and current distnace Vector3 directionToPoint = agent.transform.position.DirectionTo(grapplePoint.value); + float currentDist = Vector3.Distance(agent.transform.position, grapplePoint.value); // Calculate input Vector2 rawInput = agent.GetComponent().rawMoveInput; Vector3 input = new(rawInput.x, rawInput.y, 0f); - smoothedInput = Vector3.SmoothDamp(smoothedInput, input, ref smoothedInputRefVelocity, 2); + smoothedInput = Vector3.SmoothDamp(smoothedInput, input, ref smoothedInputRefVelocity, 1f); DebugOverlayDrawer.ChangeValue("Grapple", "Smoothed Input", smoothedInput.ToString()); - - // Change input handling based on position - if (directionToPoint.y < 0) { - - } else { - } - // Create the distance variables - float currentDist = Vector3.Distance(agent.transform.position, grapplePoint.value); + // The swing angle needs to change for the downwards swing, based on distance to the ground + Physics.Raycast(agent.transform.position, Vector3.down, out RaycastHit hit); + float distanceToGround = hit.distance; + float downwardsSwingAngle = Mathf.Lerp(30, 100, distanceToGround / 20f); + + // Altered swing angle based on distance to the grapple point, used to keep the player not too close or far + + float inwardsAngle = Mathf.Lerp(0f, -60f, currentDist / -15f); + float outwardsAngle = Mathf.Lerp(0f, -60f, currentDist / 15f); + float outputAngle = inwardsAngle + outwardsAngle; + + DebugOverlayDrawer.ChangeValue("Grapple", "Output Angle", outputAngle.ToString() + $"({inwardsAngle.ToString()} + {outwardsAngle.ToString()})"); + + // Calculate the swing direction. // Vector3 swingDirection = Quaternion.LookRotation(smoothedInput) * directionToPoint * smoothedInput.magnitude; // Old - Vector3 sidewaysSwingAngle = Quaternion.AngleAxis(90f, Vector3.up) * directionToPoint; - Vector3 upwardsSwingAngle = Quaternion.AngleAxis(-90f, Vector3.right) * directionToPoint; - // Vector3 downwardsSwingAngle = Quaternion.AngleAxis(90f, Vector3.right) * directionToPoint; // why not just use upwards but negative based on input on Y + Vector3 pointDirectionXZStable = agent.transform.position.DirectionTo(grapplePoint.value.Flatten(null, agent.transform.position.y)); + Vector3 rightSwingDirectin = Quaternion.AngleAxis(100f + outputAngle, Vector3.up) * pointDirectionXZStable; // Working + Vector3 leftSwingDirectin = Quaternion.AngleAxis(-100f - outputAngle, Vector3.up) * pointDirectionXZStable; // Working + Vector3 upwardsSwingDirection = Quaternion.AngleAxis(-140f - outputAngle, Quaternion.LookRotation(directionToPoint) * Vector3.right) * directionToPoint; // Working + Vector3 downwardsSwingDirection = Quaternion.AngleAxis(downwardsSwingAngle, Quaternion.LookRotation(directionOnStart) * Vector3.right) * directionToPoint; // WORKING NOW!! Note: this has to rotate by directionOnStart because else it just moves towards the point - // Create the composite swing direction and the target swing direction - // The composite is the output while the target is the one used in calculating - Vector3 compositeSwingDirection; + // Get the target swing direction. This is the direction "around" the point based on context Vector3 targetSwingDirection; - // if (directionToPoint.y > 0) { - DebugOverlayDrawer.ChangeValue("Grapple", "Target Swing Direction", Mathf.Abs((smoothedInput.y + 1f) / 2).ToString()); - Vector3 swingAngleAbovePoint = -upwardsSwingAngle; - - if (Mathf.Abs(smoothedInput.y) > .01f){ - swingAngleAbovePoint = Vector3.Slerp(-upwardsSwingAngle, upwardsSwingAngle, Mathf.Abs((smoothedInput.y + 1f) / 2)); + // Start with up and down + Vector3 yAxisTargetDirection; + + if (Vector3.Dot(-directionOnStart, directionToPoint) > 0) { // More than 90 degrees from the start angle, just start going forward from the swing + targetSwingDirection = finalDirection; + } else { + if (Mathf.Abs(input.y) > 0.1f) { // Input exists on up and down, switch direction based on input + yAxisTargetDirection = Vector3.Slerp(upwardsSwingDirection, downwardsSwingDirection, Mathf.Abs((input.y - 1f) / 2f)); + } else { // No input on up/down controller, so swing relative to the point + if (directionToPoint.y < 0) { // Since you're under the point swing downwards + yAxisTargetDirection = downwardsSwingDirection; + } else { // Since you're over the point, swing upwards + yAxisTargetDirection = upwardsSwingDirection; + } } - Vector3 axisFromInput = Vector3.zero; - - if (smoothedInput.x > 0) { - axisFromInput = Vector3.Slerp(swingAngleAbovePoint, sidewaysSwingAngle, smoothedInput.x); + + if (directionToPoint.y > -.5f) { + // yAxisTargetDirection += Vector3.up * 4f; // This works but it's making downward motion not work } - if (smoothedInput.x < 0) { - axisFromInput = Vector3.Slerp(swingAngleAbovePoint, -sidewaysSwingAngle, Mathf.Abs(smoothedInput.x)); - } + targetSwingDirection = yAxisTargetDirection * Mathf.Abs((input.y)); - compositeSwingDirection = Vector3.Slerp(swingAngleAbovePoint, axisFromInput, smoothedInput.x); - // } else { - // compositeSwingDirection = Vector3.Slerp(upwardsSwingAngle, sidewaysSwingAngle, smoothedInput.magnitude); - // } + if (Mathf.Abs(input.x) > 0.1f) { + Vector3 xAxisTargetDirection = Vector3.Lerp(rightSwingDirectin, leftSwingDirectin, Mathf.Abs((input.x - 1f) / 2f)); + targetSwingDirection = Vector3.Slerp(targetSwingDirection, xAxisTargetDirection, Mathf.Abs((input.x))); + // targetSwingDirection = xAxisTargetDirection; + DebugOverlayDrawer.ChangeValue("Grapple", "LR Input Dot", Mathf.Abs((input.x - 1f) / 2f).ToString()); + } + + targetSwingDirection = targetSwingDirection.normalized; + } + + // Smooth it, but don't smooth it as well if the dot product between the new direction and current direction are too large + float newDirDot = Vector3.Dot(smoothedSwingDirection, targetSwingDirection); + newDirDot = (newDirDot + 1f) / 2f; + + smoothedSwingDirection = Vector3.Slerp(smoothedSwingDirection, targetSwingDirection, 2f * Time.deltaTime * newDirDot); + + // DebugOverlayDrawer.ChangeValue("Grapple", "Downwards Swing Angle", downwardsSwingDirection.ToString()); + // DebugOverlayDrawer.ChangeValue("Grapple", "Upwards Swing Angle", upwardsSwingDirection.ToString()); + // DebugOverlayDrawer.ChangeValue("Grapple", "Right Swing Angle", rightSwingDirectin.ToString()); + // DebugOverlayDrawer.ChangeValue("Grapple", "Left Swing Angle", leftSwingDirectin.ToString()); // Some math for getting the Y yChangeMultipler = Mathf.Lerp(yChangeMultipler, 0f, elapsedTime * .5f); // Starts at 1 so that the player has more ability to change height on start of swing, then smooths to zero - DebugOverlayDrawer.ChangeValue("Grapple", "Composite Swing Direction", compositeSwingDirection.ToString()); - Debug.Log(Vector3.Dot(directionToPoint, Vector3.down)); + DebugOverlayDrawer.ChangeValue("Grapple", "Composite Swing Direction", smoothedSwingDirection.ToString()); // Speed float evaluatedSpeed = pullSpeedCurve.value.Evaluate(Mathf.Clamp((Time.time - startTime) / 6f, 0f, Mathf.Infinity)); @@ -177,31 +211,92 @@ namespace NodeCanvas.Tasks.Actions { // Soften the speed changes currentSpeed = Mathf.Lerp(currentSpeed, speedAgainstCurve, 10f * Time.deltaTime); + // Test + finalDirection = Vector3.Slerp(finalDirection, smoothedSwingDirection, (elapsedTime / 1f) + Mathf.Max(0f, smoothedInput.magnitude)); // Set to smoothedSwingDirection when done testing + // Gizmos gizmoVertValue = finalDirection.y; gizmosSmoothedInput = smoothedInput; - gizmoPointDirection = directionToPoint; - gizmoSwingDirection = swingAngleAbovePoint; + gizmoPointDirection = targetSwingDirection; + gizmoSwingDirection = smoothedSwingDirection; // Set to smoothedSwingDirection when done testing gizmoFinalDirection = finalDirection; - //Test - finalDirection = gizmoSwingDirection; - - agent.SetNewDirection(finalDirection.Flatten(null, 0)); + agent.SetNewDirection(Vector3.Lerp(agent.additionalMoveDirection, finalDirection.Flatten(null, 0), 1f * Time.deltaTime)); agent.SetNewGravity(finalDirection.y); - agent.SmoothToSpeed(0f, 1f * Time.deltaTime, out referenceSpeed); + agent.SmoothToSpeed(30f, 20f * Time.deltaTime, out referenceSpeed); // agent.SmoothToDirection(finalDirection.Flatten(null, 0).normalized * evaluatedSpeed, 1f * Time.deltaTime, out referenceDirection); // agent.SmoothToGravitation(finalDirection.y, 1f, out referenceGravity); - if (Vector3.Dot(directionOnStart, directionToPoint.normalized) < breakAtDotProduct) { - // EndAction(true); + // Calculate dot products for using to end the action + float xzDot = Vector3.Dot(directionOnStart.Flatten(null, 0f), directionToPoint.normalized.Flatten(null, 0f)); + float yDot = Vector3.Dot(directionOnStart.Flatten(0f, null, 0f), directionToPoint.normalized.Flatten(0f, null, 0f)); + + if (xzDot < breakAtDotProduct || yDot < -.9) { // TODO: Change .8 to a variable + EndAction(true); } else if (currentDist < breakAtDistance) { EndAction(true); } } + Vector3 CalculateSwingDirections(float currentDist, Vector3 directionToPoint){ + // Get input + Vector2 rawInput = agent.GetComponent().rawMoveInput; + Vector3 input = new(rawInput.x, rawInput.y, 0f); + + // The swing angle needs to change for the downwards swing, based on distance to the ground + Physics.Raycast(agent.transform.position, Vector3.down, out RaycastHit hit); + float distanceToGround = hit.distance; + + float downwardsSwingAngle = Mathf.Lerp(30, 100, distanceToGround / 20f); + + // Altered swing angle based on distance to the grapple point, used to keep the player not too close or far + + float inwardsAngle = Mathf.Lerp(0f, -60f, currentDist / -15f); + float outwardsAngle = Mathf.Lerp(0f, -60f, currentDist / 15f); + float outputAngle = inwardsAngle + outwardsAngle; + + DebugOverlayDrawer.ChangeValue("Grapple", "Output Angle", outputAngle.ToString() + $"({inwardsAngle.ToString()} + {outwardsAngle.ToString()})"); + + Vector3 pointDirectionXZStable = agent.transform.position.DirectionTo(grapplePoint.value.Flatten(null, agent.transform.position.y)); + Vector3 rightSwingDirectin = Quaternion.AngleAxis(100f + outputAngle, Vector3.up) * pointDirectionXZStable; // Working + Vector3 leftSwingDirectin = Quaternion.AngleAxis(-100f - outputAngle, Vector3.up) * pointDirectionXZStable; // Working + Vector3 upwardsSwingDirection = Quaternion.AngleAxis(-140f - outputAngle, Quaternion.LookRotation(directionToPoint) * Vector3.right) * directionToPoint; // Working + Vector3 downwardsSwingDirection = Quaternion.AngleAxis(downwardsSwingAngle, Quaternion.LookRotation(directionOnStart) * Vector3.right) * directionToPoint; // WORKING NOW!! Note: this has to rotate by directionOnStart because else it just moves towards the point + + // Get the target swing direction. This is the direction "around" the point based on context + Vector3 targetSwingDirection; + + // Start with up and down + Vector3 yAxisTargetDirection; + + if (Mathf.Abs(input.y) > 0.1f) { // Input exists on up and down, switch direction based on input + yAxisTargetDirection = Vector3.Slerp(upwardsSwingDirection, downwardsSwingDirection, Mathf.Abs((input.y - 1f) / 2f)); + } else { // No input on up/down controller, so swing relative to the point + if (directionToPoint.y < 0) { // Since you're under the point swing downwards + yAxisTargetDirection = downwardsSwingDirection; + } else { // Since you're over the point, swing upwards + yAxisTargetDirection = downwardsSwingDirection; + } + } + + if (directionToPoint.y > -.5f) { + // yAxisTargetDirection += Vector3.up * 4f; // This works but it's making downward motion not work + } + + targetSwingDirection = yAxisTargetDirection * Mathf.Abs((input.y)); + + if (Mathf.Abs(input.x) > 0.1f) { + Vector3 xAxisTargetDirection = Vector3.Lerp(rightSwingDirectin, leftSwingDirectin, Mathf.Abs((input.x - 1f) / 2f)); + targetSwingDirection = Vector3.Slerp(targetSwingDirection, xAxisTargetDirection, Mathf.Abs((input.x))); + // targetSwingDirection = xAxisTargetDirection; + DebugOverlayDrawer.ChangeValue("Grapple", "LR Input Dot", Mathf.Abs((input.x - 1f) / 2f).ToString()); + } + + return targetSwingDirection.normalized; + } + public void DrawGrappleGizmo(){ // Destination gizmos using (Draw.WithColor(Color.blue)){ @@ -234,7 +329,7 @@ namespace NodeCanvas.Tasks.Actions { using (Draw.WithColor(dirColor)) { float pointLength = 1.2f; Vector3 pointStart = agent.transform.position + Vector3.up * .2f; - Vector3 pointDir = pointStart + gizmoPointDirection.normalized * pointLength; + Vector3 pointDir = grapplePoint.value; Draw.DashedLine(pointStart, pointDir, .2f, .2f); Draw.ArrowheadArc(pointStart, gizmoPointDirection.normalized, pointLength, 15f); Draw.Label2D(pointDir + Vector3.up * .4f, "Grapple Point Direction"); diff --git a/Assets/Scripts/Core/Tools/DebugOverlayDrawer.cs b/Assets/Scripts/Core/Tools/DebugOverlayDrawer.cs index 971463e..2bfdacf 100644 --- a/Assets/Scripts/Core/Tools/DebugOverlayDrawer.cs +++ b/Assets/Scripts/Core/Tools/DebugOverlayDrawer.cs @@ -140,10 +140,8 @@ namespace Reset.Core.Tools{ try { AddOnOverlay(pageName, sourceName); Instance.values[$"{pageName}/{sourceName}"].text = newValue; - throw; } catch (Exception exception) { Debug.LogError($"Failed to both update an existing or create a new debug overlay: {exception.Message}" ); - throw; } } } diff --git a/Assets/Scripts/Player/UnitMovementHandler.cs b/Assets/Scripts/Player/UnitMovementHandler.cs index 7138a26..c2afd4e 100644 --- a/Assets/Scripts/Player/UnitMovementHandler.cs +++ b/Assets/Scripts/Player/UnitMovementHandler.cs @@ -1,5 +1,4 @@ using System; -using System.Numerics; using NUnit.Framework.Internal; using UnityEngine; using ParadoxNotion.Design; @@ -7,8 +6,6 @@ using Sirenix.OdinInspector; using UnityEditor.Rendering; using UnityEngine.Serialization; using Quaternion = UnityEngine.Quaternion; -using Vector2 = UnityEngine.Vector2; -using Vector3 = UnityEngine.Vector3; public enum PlayerFacingDirection{ TowardsTarget = 0, @@ -72,7 +69,7 @@ namespace Reset.Units{ [ShowInInspector, ReadOnly] private float outputSpeed; [ShowInInspector, ReadOnly] private float additionalSpeed; [ShowInInspector, ReadOnly] public Vector3 outputMoveDirection; - [ShowInInspector, ReadOnly] private Vector3 additionalMoveDirection; + [ShowInInspector, ReadOnly] public Vector3 additionalMoveDirection; [ShowInInspector, ReadOnly] private Quaternion outputRotation; [ShowInInspector, ReadOnly] private Quaternion specifiedRotation; [ShowInInspector, ReadOnly] private float outputRotationSpeed; @@ -138,7 +135,7 @@ namespace Reset.Units{ } public void SmoothToSpeed(float desiredSpeed, float smoothing, out float referenceSpeed){ - additionalSpeed = Mathf.Lerp(outputSpeed, desiredSpeed, smoothing * Time.deltaTime); + additionalSpeed = Mathf.Lerp(additionalSpeed, desiredSpeed, smoothing * Time.deltaTime); referenceSpeed = additionalSpeed; } @@ -257,7 +254,7 @@ namespace Reset.Units{ float gravityMoveDirection = data.jumpPower + (Physics.gravity.y * data.gravityPower); // Commit gravity to move direction, ignoring XZ since those are done in UpdateMovementDirection - // outputMoveDirection.y = Mathf.SmoothDamp(outputMoveDirection.y, gravityMoveDirection, ref gravitySmooth, .1f * Time.deltaTime); + outputMoveDirection.y = Mathf.SmoothDamp(outputMoveDirection.y, gravityMoveDirection, ref gravitySmooth, .1f * Time.deltaTime); } // Update the rotation, called every frame diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 0a10e46..93cfcfc 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -9,6 +9,6 @@ EditorBuildSettings: path: Assets/Scenes/SampleScene.unity guid: 99c9720ab356a0642a771bea13969a05 m_configObjects: - com.unity.input.settings: {fileID: 11400000, guid: 8e19eb4aa4fac2a409e792d0d3e5f944, type: 2} - com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3} + com.unity.input.settings: {fileID: 11400000, guid: e4ca318d34698fe41ba99a765e54e4c2, type: 2} + com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 94c7611bb3f64b248940847af54844cf, type: 3} m_UseUCBPForAssetBundles: 0