From 5165f79ed248ed1b6fbb69160a865b09f5e28e4c Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 5 Aug 2025 16:38:59 -0400 Subject: [PATCH] added: axis enabled and gain settings to camera settings processor --- Assets/Player/Graphs/GrappleAimBT.asset | 20 +++-- .../Core/Graph Tasks/ChangeCameraSettings.cs | 82 ++++++++++++++++++- .../Scripts/Player/CameraSettingsProcessor.cs | 32 ++++++++ 3 files changed, 125 insertions(+), 9 deletions(-) diff --git a/Assets/Player/Graphs/GrappleAimBT.asset b/Assets/Player/Graphs/GrappleAimBT.asset index 35ac229..230a47a 100644 --- a/Assets/Player/Graphs/GrappleAimBT.asset +++ b/Assets/Player/Graphs/GrappleAimBT.asset @@ -15,19 +15,25 @@ MonoBehaviour: _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":89.95151,"y":510.918},"$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 Position","newValue":{"x":2.0,"y":0.5,"z":-1.0},"changeX":1,"changeY":1,"changeZ":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":-85.3679,"y":667.3029},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"2"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":336.0,"y":511.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"3"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":568.0,"y":515.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"4"},{"policy":1,"dynamic":true,"_position":{"x":749.7742,"y":517.9701},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"5"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":247.0,"y":763.0},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"6"},{"_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":{"_name":"_observerHit"},"overrideAgent":{"_type":"UnityEngine.Transform","_name":"camera","_targetVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba"},"$type":"Reset.CheckGenericObserver"},"_position":{"x":209.0,"y":871.0},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"7"},{"_action":{"boolVariable":{"_name":"_castHit"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":127.0,"y":975.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"8"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":320.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"9"},{"_position":{"x":841.0,"y":848.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"10"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":540.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"11"},{"_condition":{"valueA":{"_name":"_castHit"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":569.0,"y":1079.0},"$type":"NodeCanvas.BehaviourTrees.ConditionalEvaluator","$id":"12"},{"_action":{"eventName":{"_value":"Started - Tilt Controls"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent"},"_position":{"x":511.9847,"y":1182.83},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"13"},{"_position":{"x":852.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"14"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":799.0,"y":1035.0},"$type":"NodeCanvas.BehaviourTrees.Interruptor","$id":"15"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":872.6089,"y":1145.236},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"16"},{"_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":772.6562,"y":1253.63},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"17"},{"_action":{"eventName":{"_value":"Confirmed - Choice"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent"},"_position":{"x":1059.947,"y":979.5414},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"18"},{"policy":1,"_position":{"x":928.0059,"y":524.0208},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"19"},{"_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":965.381,"y":658.2095},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"20"},{"_action":{"log":{"_value":"Cancelled"},"secondsToRun":0.0,"$type":"NodeCanvas.Tasks.Actions.DebugLogText"},"_position":{"x":1046.394,"y":796.2429},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"21"},{"_action":{"actions":[{"fieldOfView":{"label":"FOV","changeValue":2},"orbitFollowTop":{"label":"Top","changeHeight":2,"changeRadius":2},"orbitFollowCenter":{"label":"Center","changeHeight":2,"changeRadius":2},"orbitFollowBottom":{"label":"Bottom","changeHeight":2,"changeRadius":2},"screenPosition":{"label":"Screen + Tilt Controls"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent"},"_position":{"x":511.9847,"y":1182.83},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"13"},{"_position":{"x":852.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"14"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":799.0,"y":1035.0},"$type":"NodeCanvas.BehaviourTrees.Interruptor","$id":"15"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":902.6089,"y":1145.236},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"16"},{"_position":{"x":912.0,"y":1202.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"17"},{"_action":{"orbitTargetOffset":{"label":"Target + Offset","newValue":{"y":0.04},"changeX":2,"changeY":1},"axisLookXGain":{"label":"Look + Orbit X Gain","changeValue":1},"axisLookYGain":{"label":"Look Orbit Y Gain","changeValue":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":550.5596,"y":1329.851},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"18"},{"_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":753.6562,"y":1331.63},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"19"},{"_condition":{"valueA":{"_name":"_lookDirY"},"checkType":1,"valueB":{"_value":0.2},"differenceThreshold":0.1,"$type":"NodeCanvas.Tasks.Conditions.CheckFloat"},"_position":{"x":1076.257,"y":1335.687},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"20"},{"_action":{"orbitTargetOffset":{"label":"Target + Offset","newValue":{"y":0.04},"changeY":1},"enableXAxis":{"label":"Input Axis + X Enabled","changeValue":1},"enableYAxis":{"label":"Input Axis Y Enabled","changeValue":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":958.9839,"y":1482.521},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"21"},{"_action":{"orbitTargetOffset":{"label":"Target + Offset","changeY":2},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":1176.0,"y":1476.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"22"},{"_action":{"eventName":{"_value":"Confirmed + Choice"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent"},"_position":{"x":1059.947,"y":979.5414},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"23"},{"policy":1,"_position":{"x":928.0059,"y":524.0208},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"24"},{"_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":965.381,"y":658.2095},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"25"},{"_action":{"log":{"_value":"Cancelled"},"secondsToRun":0.0,"$type":"NodeCanvas.Tasks.Actions.DebugLogText"},"_position":{"x":1046.394,"y":796.2429},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"26"},{"_action":{"actions":[{"fieldOfView":{"label":"FOV","changeValue":2},"orbitFollowTop":{"label":"Top","changeHeight":2,"changeRadius":2},"orbitFollowCenter":{"label":"Center","changeHeight":2,"changeRadius":2},"orbitFollowBottom":{"label":"Bottom","changeHeight":2,"changeRadius":2},"axisLookXGain":{"label":"Look + Orbit X Gain","changeValue":2},"axisLookYGain":{"label":"Look Orbit Y Gain","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, - UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":1105.84,"y":503.1857},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"22"},{"failureRemap":1,"_position":{"x":400.0,"y":1531.0},"$type":"NodeCanvas.BehaviourTrees.Remapper","$id":"23"},{"_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":"24"},{"monitorMode":1,"_position":{"x":-312.8632,"y":1265.204},"$type":"NodeCanvas.BehaviourTrees.Monitor","$id":"25"},{"_position":{"x":-309.8632,"y":1368.204},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"26"},{"_position":{"x":-307.8632,"y":1422.204},"$type":"NodeCanvas.BehaviourTrees.Selector","$id":"27"},{"_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":{"_name":"_observerHit"},"overrideAgent":{"_type":"UnityEngine.Transform","_name":"camera","_targetVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba"},"$type":"Reset.CheckGenericObserver"},"_position":{"x":-621.8632,"y":1503.204},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"28"},{"_position":{"x":-659.8632,"y":1633.204},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"29"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-914.8632,"y":1736.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"30"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-726.2145,"y":1735.09},"$type":"NodeCanvas.BehaviourTrees.ConditionNode","$id":"31"},{"_action":{"boolVariable":{"_name":"_castHit"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-505.8632,"y":1739.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"32"},{"policy":1,"dynamic":true,"_position":{"x":-305.8632,"y":1532.204},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"33"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":-311.8632,"y":1674.204},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"34"},{"_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":"35"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-159.1308,"y":1664.066},"$type":"NodeCanvas.BehaviourTrees.ConditionNode","$id":"36"},{"_condition":{"valueA":{"_name":"_lookDir"},"checkType":1,"valueB":{"_value":0.2},"differenceThreshold":0.1,"$type":"NodeCanvas.Tasks.Conditions.CheckFloat"},"_position":{"x":1122.257,"y":1247.687},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"37"},{"_action":{"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":1046.0,"y":1377.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"38"},{"_position":{"x":1242.0,"y":1377.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"39"}],"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":"19"},"_isDisabled":true,"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"22"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"10"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"7"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"7"},"_targetNode":{"$ref":"8"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"7"},"_targetNode":{"$ref":"9"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"10"},"_targetNode":{"$ref":"11"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"10"},"_targetNode":{"$ref":"14"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"10"},"_targetNode":{"$ref":"18"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"11"},"_targetNode":{"$ref":"12"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"12"},"_targetNode":{"$ref":"13"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"14"},"_targetNode":{"$ref":"15"},"$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":"19"},"_targetNode":{"$ref":"20"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"20"},"_targetNode":{"$ref":"21"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"23"},"_targetNode":{"$ref":"24"},"$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":"27"},"_targetNode":{"$ref":"28"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"27"},"_targetNode":{"$ref":"33"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"28"},"_targetNode":{"$ref":"29"},"$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":"29"},"_targetNode":{"$ref":"32"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"33"},"_targetNode":{"$ref":"34"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"33"},"_targetNode":{"$ref":"36"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"34"},"_targetNode":{"$ref":"35"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"37"},"_targetNode":{"$ref":"38"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"37"},"_targetNode":{"$ref":"39"},"$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.PhysicsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":1106.84,"y":503.1857},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"27"},{"failureRemap":1,"_position":{"x":400.0,"y":1531.0},"$type":"NodeCanvas.BehaviourTrees.Remapper","$id":"28"},{"_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":"29"},{"monitorMode":1,"_position":{"x":-312.8632,"y":1265.204},"$type":"NodeCanvas.BehaviourTrees.Monitor","$id":"30"},{"_position":{"x":-309.8632,"y":1368.204},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"31"},{"_position":{"x":-307.8632,"y":1422.204},"$type":"NodeCanvas.BehaviourTrees.Selector","$id":"32"},{"_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":{"_name":"_observerHit"},"overrideAgent":{"_type":"UnityEngine.Transform","_name":"camera","_targetVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba"},"$type":"Reset.CheckGenericObserver"},"_position":{"x":-621.8632,"y":1503.204},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"33"},{"_position":{"x":-659.8632,"y":1633.204},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"34"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-914.8632,"y":1736.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"35"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-726.2145,"y":1735.09},"$type":"NodeCanvas.BehaviourTrees.ConditionNode","$id":"36"},{"_action":{"boolVariable":{"_name":"_castHit"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-505.8632,"y":1739.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"37"},{"policy":1,"dynamic":true,"_position":{"x":-305.8632,"y":1532.204},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"38"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":-311.8632,"y":1674.204},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"39"},{"_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":"40"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-159.1308,"y":1664.066},"$type":"NodeCanvas.BehaviourTrees.ConditionNode","$id":"41"}],"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":"24"},"_isDisabled":true,"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"27"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"10"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"7"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"7"},"_targetNode":{"$ref":"8"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"7"},"_targetNode":{"$ref":"9"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"10"},"_targetNode":{"$ref":"11"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"10"},"_targetNode":{"$ref":"14"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"10"},"_targetNode":{"$ref":"23"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"11"},"_targetNode":{"$ref":"12"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"12"},"_targetNode":{"$ref":"13"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"14"},"_targetNode":{"$ref":"15"},"$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":"17"},"_targetNode":{"$ref":"19"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"17"},"_targetNode":{"$ref":"20"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"20"},"_targetNode":{"$ref":"21"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"20"},"_targetNode":{"$ref":"22"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"24"},"_targetNode":{"$ref":"25"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"25"},"_targetNode":{"$ref":"26"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"28"},"_targetNode":{"$ref":"29"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"30"},"_targetNode":{"$ref":"31"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"31"},"_targetNode":{"$ref":"32"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"32"},"_targetNode":{"$ref":"33"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"32"},"_targetNode":{"$ref":"38"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"33"},"_targetNode":{"$ref":"34"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"34"},"_targetNode":{"$ref":"35"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"34"},"_targetNode":{"$ref":"36"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"34"},"_targetNode":{"$ref":"37"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"38"},"_targetNode":{"$ref":"39"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"38"},"_targetNode":{"$ref":"41"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"39"},"_targetNode":{"$ref":"40"},"$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]]"}}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}' _objectReferences: [] _graphSource: _version: 3.31 _category: _comments: - _translation: {x: 162, y: -631} - _zoomFactor: 1 + _translation: {x: 82, y: -452} + _zoomFactor: 0.9976506 _haltSerialization: 0 _externalSerializationFile: {fileID: 0} diff --git a/Assets/Scripts/Core/Graph Tasks/ChangeCameraSettings.cs b/Assets/Scripts/Core/Graph Tasks/ChangeCameraSettings.cs index 73f8256..ff957d3 100644 --- a/Assets/Scripts/Core/Graph Tasks/ChangeCameraSettings.cs +++ b/Assets/Scripts/Core/Graph Tasks/ChangeCameraSettings.cs @@ -89,7 +89,63 @@ public struct FloatCameraValueGroup : ICameraValueGroup{ } } +public struct BoolCameraValueGroup : ICameraValueGroup{ + public string label; + public bool value; + + public CameraSettingsToggle changeValue; + + public BoolCameraValueGroup(string newLabel){ + label = newLabel; + value = true; + changeValue = CameraSettingsToggle.NoChange; + } +} + #if UNITY_EDITOR +public class BoolCameraValueGroupDrawer : ObjectDrawer { + public override BoolCameraValueGroup OnGUI(GUIContent content, BoolCameraValueGroup _instance){ + // Remove label for floats + EditorGUIUtility.labelWidth = 50; + + // Set layout options for the label and the float fields + GUILayoutOption[] floatOptions = new GUILayoutOption[] { + GUILayout.Width(80.0f), + GUILayout.MinWidth(20.0f), + GUILayout.ExpandWidth(true), + }; + + GUILayoutOption[] labelOptions = new GUILayoutOption[]{ + GUILayout.Width(200.0f), + }; + + // Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options + GUILayout.BeginVertical(); + GUILayout.Label(_instance.ToString(), labelOptions); + GUILayout.BeginHorizontal(); + + // Create the x settings enum + _instance.changeValue = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", instance.changeValue); + + // Create the value/disabled information field + if (_instance.changeValue == CameraSettingsToggle.NewValue){ + _instance.value = EditorGUILayout.Toggle(_instance.value, floatOptions); + } else { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(_instance.changeValue == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions); + EditorGUI.EndDisabledGroup(); + } + + // Close this line up + GUILayout.EndHorizontal(); + GUILayout.EndVertical(); + + // Reset to default so the rest of things don't get messed up + EditorGUIUtility.labelWidth = 0; + return _instance; + } +} + public class FloatCameraValueGroupDrawer : ObjectDrawer { public override FloatCameraValueGroup OnGUI(GUIContent _content, FloatCameraValueGroup _instance){ // Remove label for floats @@ -338,6 +394,12 @@ namespace NodeCanvas.Tasks.Actions { public OrbitalFollowValueGroup orbitFollowTop = new (newLabel: "Top"); public OrbitalFollowValueGroup orbitFollowCenter = new (newLabel: "Center"); public OrbitalFollowValueGroup orbitFollowBottom = new (newLabel: "Bottom"); + + public BoolCameraValueGroup enableXAxis = new (newLabel: "Input Axis X Enabled"); + public BoolCameraValueGroup enableYAxis = new (newLabel: "Input Axis Y Enabled"); + + public FloatCameraValueGroup axisLookXGain = new (newLabel: "Look Orbit X Gain"); + public FloatCameraValueGroup axisLookYGain = new (newLabel: "Look Orbit Y Gain"); [ParadoxNotion.Design.Header("Rotation Composer Settings")] public Vector2CameraValueGroup screenPosition = new (newLabel: "Screen Position"); @@ -362,11 +424,16 @@ namespace NodeCanvas.Tasks.Actions { UpdateVector3Value(cameraOffset, ref CameraSettingsProcessor.values.cameraOffsetOffset); UpdateVector3Value(orbitPositionDamping, ref CameraSettingsProcessor.values.orbitPositionDamping); - // UpdateVector3Value(orbitTargetOffset, ref CameraSettingsProcessor.values.orbitTargetOffset); + UpdateVector3Value(orbitTargetOffset, ref CameraSettingsProcessor.values.orbitTargetOffset); UpdateVector2Value(screenPosition, ref CameraSettingsProcessor.values.rotationComposerScreenPos); UpdateFloatValue(fieldOfView, ref CameraSettingsProcessor.values.mainFieldOfView); + UpdateFloatValue(axisLookXGain, ref CameraSettingsProcessor.values.axisLookGainX); + UpdateFloatValue(axisLookYGain, ref CameraSettingsProcessor.values.axisLookGainY); + + + EndAction(true); } @@ -438,7 +505,18 @@ namespace NodeCanvas.Tasks.Actions { break; } } - + + public void UpdateBoolValue(BoolCameraValueGroup valueGroup, ref CameraSettingSingleValue targetProperty){ + switch (valueGroup.changeValue) { + case CameraSettingsToggle.NewValue: + targetProperty.targetValue = valueGroup.value; + break; + case CameraSettingsToggle.ResetValue: + targetProperty.targetValue = targetProperty.originalValue; + break; + } + } + public void UpdateFloatValue(FloatCameraValueGroup valueGroup, ref CameraSettingSingleValue targetProperty){ switch (valueGroup.changeValue) { case CameraSettingsToggle.NewValue: diff --git a/Assets/Scripts/Player/CameraSettingsProcessor.cs b/Assets/Scripts/Player/CameraSettingsProcessor.cs index 3c1a697..6c5a50b 100644 --- a/Assets/Scripts/Player/CameraSettingsProcessor.cs +++ b/Assets/Scripts/Player/CameraSettingsProcessor.cs @@ -32,6 +32,12 @@ public struct CameraSettingValues{ public CameraSettingSingleValue orbitPositionDamping; public CameraSettingSingleValue orbitTargetOffset; + public CameraSettingSingleValue axisLookEnabledX; + public CameraSettingSingleValue axisLookEnabledY; + + public CameraSettingSingleValue axisLookGainX; + public CameraSettingSingleValue axisLookGainY; + public CameraSettingSingleValue orbitFollowTopHeight; public CameraSettingSingleValue orbitFollowTopRadius; public CameraSettingSingleValue orbitFollowCenterHeight; @@ -48,6 +54,12 @@ public struct CameraSettingValues{ orbitPositionDamping = new CameraSettingSingleValue(defaultSmoothing); orbitTargetOffset = new CameraSettingSingleValue(defaultSmoothing); + + axisLookEnabledX = new CameraSettingSingleValue(); + axisLookEnabledY = new CameraSettingSingleValue(); + + axisLookGainX = new CameraSettingSingleValue(defaultSmoothing); + axisLookGainY = new CameraSettingSingleValue(defaultSmoothing); orbitFollowTopHeight = new CameraSettingSingleValue(defaultSmoothing); orbitFollowTopRadius = new CameraSettingSingleValue(defaultSmoothing); @@ -72,6 +84,7 @@ public class CameraSettingsProcessor : MonoBehaviour{ private CinemachineOrbitalFollow orbit; private CinemachineRotationComposer rotComp; private CinemachineCameraOffset offset; + private CinemachineInputAxisController axisCont; public void Awake(){ // Singleton management @@ -87,11 +100,16 @@ public class CameraSettingsProcessor : MonoBehaviour{ orbit = mainCamera.GetComponent(); rotComp = mainCamera.GetComponent(); offset = mainCamera.GetComponent(); + axisCont = mainCamera.GetComponent(); // Initialize camera settings values values = new CameraSettingValues{ cameraOffsetOffset = new CameraSettingSingleValue(defaultSmoothing: .2f, offset.Offset), mainFieldOfView = new CameraSettingSingleValue(defaultSmoothing: .2f, main.Lens.FieldOfView), + axisLookEnabledX = new CameraSettingSingleValue(0f, axisCont.Controllers[0].Enabled), + axisLookEnabledY = new CameraSettingSingleValue(0f, axisCont.Controllers[1].Enabled), + axisLookGainX = new CameraSettingSingleValue(defaultSmoothing: .2f, axisCont.Controllers[0].Input.Gain), + axisLookGainY = new CameraSettingSingleValue(defaultSmoothing: .2f, axisCont.Controllers[1].Input.Gain), orbitPositionDamping = new CameraSettingSingleValue(defaultSmoothing: .2f, orbit.TrackerSettings.PositionDamping), orbitFollowTopHeight = new CameraSettingSingleValue(defaultSmoothing: .2f, orbit.Orbits.Top.Height), orbitFollowTopRadius = new CameraSettingSingleValue(defaultSmoothing: .2f, orbit.Orbits.Top.Radius), @@ -107,6 +125,18 @@ public class CameraSettingsProcessor : MonoBehaviour{ main.Lens.FieldOfView = Mathf.SmoothDamp(main.Lens.FieldOfView, values.mainFieldOfView.targetValue, ref values.mainFieldOfView.velocityRef, values.mainFieldOfView.smoothing); + + axisCont.Controllers[0].Enabled = values.axisLookEnabledX.targetValue; + + axisCont.Controllers[1].Enabled = values.axisLookEnabledY.targetValue; + + axisCont.Controllers[0].Input.Gain = Mathf.SmoothDamp(axisCont.Controllers[0].Input.Gain, + values.axisLookGainX.targetValue, ref values.axisLookGainX.velocityRef, + values.axisLookGainX.smoothing); + + axisCont.Controllers[1].Input.Gain = Mathf.SmoothDamp(axisCont.Controllers[1].Input.Gain, + values.axisLookGainY.targetValue, ref values.axisLookGainY.velocityRef, + values.axisLookGainY.smoothing); orbit.TargetOffset = Vector3.SmoothDamp(orbit.TargetOffset, values.orbitTargetOffset.targetValue, ref values.orbitTargetOffset.velocityRefV3, @@ -147,6 +177,8 @@ public class CameraSettingsProcessor : MonoBehaviour{ offset.Offset = Vector3.SmoothDamp(offset.Offset, values.cameraOffsetOffset.targetValue, ref values.cameraOffsetOffset.velocityRefV3, values.cameraOffsetOffset.smoothing); + + } void Update(){