fix: walking out of grounded jittering fixed #3

Merged
tealtxgr merged 3 commits from maint/bugs/b143-airborne-jitter into main 2025-07-15 21:09:46 +00:00
8 changed files with 146 additions and 41 deletions

View File

@@ -0,0 +1,24 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7a686a47eee2fa44cb0a34b5d86e4d5e, type: 3}
m_Name: GroundedCheckBT
m_EditorClassIdentifier:
_serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":476.0,"y":327.0},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"0"},{"_position":{"x":550.0,"y":433.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"1"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"09b3259f-8b50-439a-ab86-ea3d8a4916f1"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":458.0,"y":522.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"2"},{"_action":{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"inputVector3":{"_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},"$type":"NodeCanvas.Tasks.Actions.SetAirMovement"},"_position":{"x":396.0,"y":655.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"3"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"09b3259f-8b50-439a-ab86-ea3d8a4916f1"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":715.0,"y":523.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"4"}],"connections":[{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}'
_objectReferences: []
_graphSource:
_version: 3.31
_category:
_comments:
_translation: {x: 150, y: -43}
_zoomFactor: 1
_haltSerialization: 0
_externalSerializationFile: {fileID: 0}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f9aba4b029eacea44966829321f0124a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -6701,7 +6701,7 @@ CharacterController:
m_Enabled: 1 m_Enabled: 1
serializedVersion: 3 serializedVersion: 3
m_Height: 2 m_Height: 2
m_Radius: 0.8 m_Radius: 0.49
m_SlopeLimit: 45 m_SlopeLimit: 45
m_StepOffset: 0.3 m_StepOffset: 0.3
m_SkinWidth: 0.01 m_SkinWidth: 0.01
@@ -6720,9 +6720,21 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_parentBlackboard: {fileID: 0} _parentBlackboard: {fileID: 0}
_serializedBlackboard: '{"_variables":{}}' _serializedBlackboard: '{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"09b3259f-8b50-439a-ab86-ea3d8a4916f1","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"airMoveDirection":{"_name":"airMoveDirection","_id":"2fc91db6-09dd-4a1f-9195-426a0c44de31","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"groundMoveDirection":{"_name":"groundMoveDirection","_id":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}}}'
_objectReferences: [] _objectReferences: []
_serializedVariables: [] _serializedVariables:
- _json: '{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"09b3259f-8b50-439a-ab86-ea3d8a4916f1","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}'
_references: []
- _json: '{"_name":"airMoveDirection","_id":"2fc91db6-09dd-4a1f-9195-426a0c44de31","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}'
_references: []
- _json: '{"_name":"groundMoveDirection","_id":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}'
_references: []
--- !u!114 &1992890478 --- !u!114 &1992890478
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -6737,36 +6749,33 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_serializedExposedParameters: [] _serializedExposedParameters: []
_boundGraphSerialization: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_onEnterList":{"executionMode":1,"actions":[{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"valueB":{"_value":4},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[System.Int32, _boundGraphSerialization: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_onEnterList":{"executionMode":1,"actions":[{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"valueB":{"_value":4},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[System.Int32,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},{"valueA":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"valueB":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[UnityEngine.Vector3, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},{"valueA":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"valueB":{"_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},"_isDisabled":true,"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[UnityEngine.Vector3,
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[{"valueA":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"valueB":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldExit":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Ground
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"foldEnter":true,"foldExit":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Ground Idle","_position":{"x":322.7396,"y":172.6144},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"0"},{"_onEnterList":{"executionMode":1,"actions":[{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"Operation":2,"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetInt"}]},"_onUpdateList":{"executionMode":1,"actions":[{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},"playerFacingDirection":{"_name":"facingDirection","_targetVariableID":"ff039cd9-e306-4c88-84db-54cbd3708ed5"},"$type":"NodeCanvas.Tasks.Actions.CalculateAirMovement"}]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Airborn
Idle","_position":{"x":441.1072,"y":185.9887},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"0"},{"_onEnterList":{"executionMode":1,"actions":[{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"Operation":2,"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetInt"}]},"_onUpdateList":{"executionMode":1,"actions":[{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"$type":"NodeCanvas.Tasks.Actions.CalculateAirMovement"}]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Airborn (Actionable)","_position":{"x":665.0512,"y":-148.5536},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"1"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":18.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"playerFacingDirection":{"_name":"facingDirection","_targetVariableID":"ff039cd9-e306-4c88-84db-54cbd3708ed5"},"standStillJumpStrength":{},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":0.2},"directionalForce":{"_value":{"y":1.0,"z":0.3}},"directionalForceStrength":{"_value":1.0},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Wall
(Actionable)","_position":{"x":607.037,"y":-147.5533},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"1"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":18.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"standStillJumpStrength":{},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":0.2},"directionalForce":{"_value":{"y":1.0,"z":0.3}},"directionalForceStrength":{"_value":1.0},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Wall Climb Jump","_position":{"x":1065.998,"y":-269.9991},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"2"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"playerFacingDirection":{"_name":"facingDirection","_targetVariableID":"ff039cd9-e306-4c88-84db-54cbd3708ed5"},"standStillJumpStrength":{},"jumpPower":{},"currentVelocityInheritence":{},"directionalForce":{},"directionalForceStrength":{},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Wall
Climb Jump","_position":{"x":1065.998,"y":-269.9991},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"2"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{},"airMoveDirection":{},"standStillJumpStrength":{},"jumpPower":{},"currentVelocityInheritence":{},"directionalForce":{},"directionalForceStrength":{},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Wall Jump","_position":{"x":868.4374,"y":-422.9596},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"3"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":12.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"playerFacingDirection":{"_name":"facingDirection","_targetVariableID":"ff039cd9-e306-4c88-84db-54cbd3708ed5"},"standStillJumpStrength":{"_value":1.0},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":1.0},"directionalForce":{},"directionalForceStrength":{},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Standard
Jump","_position":{"x":868.4374,"y":-419.9596},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"3"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":12.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"standStillJumpStrength":{"_value":1.0},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":1.0},"directionalForce":{},"directionalForceStrength":{},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Standard Jump","_position":{"x":879.2953,"y":92.40906},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"4"},{"_onEnterList":{"executionMode":1,"actions":[]},"_onUpdateList":{"executionMode":1,"actions":[{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},"playerFacingDirection":{"_name":"facingDirection","_targetVariableID":"ff039cd9-e306-4c88-84db-54cbd3708ed5"},"$type":"NodeCanvas.Tasks.Actions.CalculateAirMovement"}]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Airborn","_position":{"x":145.816,"y":-27.25839},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"5"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":10.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"playerFacingDirection":{"_name":"facingDirection","_targetVariableID":"ff039cd9-e306-4c88-84db-54cbd3708ed5"},"standStillJumpStrength":{},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":0.3},"directionalForce":{"_value":{"x":1.0,"z":1.0}},"directionalForceStrength":{"_value":10.0},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Wall
Jump","_position":{"x":831.2836,"y":45.40904},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"4"},{"_onEnterList":{"executionMode":1,"actions":[]},"_onUpdateList":{"executionMode":1,"actions":[{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"$type":"NodeCanvas.Tasks.Actions.CalculateAirMovement"}]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Airborn","_position":{"x":213.7761,"y":-7.08618},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"5"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":10.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"standStillJumpStrength":{},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":0.3},"directionalForce":{"_value":{"x":1.0,"z":1.0}},"directionalForceStrength":{"_value":10.0},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Wall Jump","_position":{"x":328.7507,"y":-416.5261},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"6"},{"_subFSM":{"_value":1},"_variablesMap":[{"_targetSubGraphVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6","_canRead":true,"_canWrite":true,"_type":"UnityEngine.Vector3","_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},{"_targetSubGraphVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5","_canRead":true,"_canWrite":true,"_type":"System.Single","_name":"rotationSpeed","_targetVariableID":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611"}],"_position":{"x":-257.669,"y":558.3375},"$type":"NodeCanvas.StateMachines.ConcurrentSubFSM"},{"_conditionList":{"conditions":[{"_invert":true,"$type":"NodeCanvas.Tasks.Conditions.DebugCondition"}]},"_actionList":{"executionMode":1,"actions":[{"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"gravityAcceleration":{"_value":1.0},"gravityMax":{"_value":8.0},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"jumpPowerDecay":{"_value":2.0},"playerFacingDirection":{"_name":"facingDirection","_targetVariableID":"ff039cd9-e306-4c88-84db-54cbd3708ed5"},"rotationSpeed":{"_name":"rotationSpeed","_targetVariableID":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611"},"rotationSmoothing":{"_value":1.0},"gravityPower":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"$type":"NodeCanvas.Tasks.Actions.ProcessMovement"}]},"_position":{"x":-260.1776,"y":405.5469},"$type":"NodeCanvas.StateMachines.OnFSMEnter"},{"_subTree":{"_value":2},"_position":{"x":-43.41095,"y":552.2315},"$type":"NodeCanvas.StateMachines.ConcurrentSubTree"},{"_subTree":{"_value":3},"_tag":"","_position":{"x":455.3837,"y":22.14105},"_comment":"","$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"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"eventName":{"_value":"ForwardRay"},"value":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckEventValue`1[[System.Boolean,
Jump","_position":{"x":328.7507,"y":-415.5261},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"6"},{"_actionList":{"executionMode":1,"actions":[{"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.7,"changeRadius":1,"radius":2.0},"screenPosition":{"label":"Screen mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"eventName":{"_value":"RightRay"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInt"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"eventName":{"_value":"LeftRay"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"4"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"619300a4-be8b-4ad4-ba2a-978468094ba2","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean,
Position","newValue":{"x":-0.25}},"cameraOffset":{"label":"Screen Position","newValue":{"x":2.0},"changeX":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"}]},"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":803.9675,"y":376.7423},"$type":"NodeCanvas.StateMachines.ActionState","$id":"7"},{"_actionList":{"executionMode":1,"actions":[{"orbitFollowTop":{"label":"Top","changeHeight":2,"changeRadius":2},"orbitFollowCenter":{"changeHeight":2,"changeRadius":2},"orbitFollowBottom":{"changeHeight":2,"changeRadius":2},"cameraOffset":{"label":"Screen
Position","changeX":2},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"}]},"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":583.0,"y":512.0},"$type":"NodeCanvas.StateMachines.ActionState","$id":"8"},{"_subFSM":{"_value":1},"_variablesMap":[{"_targetSubGraphVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6","_canRead":true,"_canWrite":true,"_type":"UnityEngine.Vector3","_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},{"_targetSubGraphVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5","_canRead":true,"_canWrite":true,"_type":"System.Single","_name":"rotationSpeed","_targetVariableID":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611"}],"_position":{"x":-257.669,"y":558.3375},"$type":"NodeCanvas.StateMachines.ConcurrentSubFSM"},{"_conditionList":{"conditions":[{"_invert":true,"$type":"NodeCanvas.Tasks.Conditions.DebugCondition"}]},"_actionList":{"executionMode":1,"actions":[{"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"gravityAcceleration":{"_value":1.0},"gravityMax":{"_value":8.0},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"jumpPowerDecay":{"_value":2.0},"playerFacingDirection":1,"rotationSpeed":{"_name":"rotationSpeed","_targetVariableID":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611"},"rotationSmoothing":{"_value":1.0},"gravityPower":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"$type":"NodeCanvas.Tasks.Actions.ProcessMovement"}]},"_position":{"x":-260.1776,"y":405.5469},"$type":"NodeCanvas.StateMachines.OnFSMEnter"},{"_subTree":{"_value":2},"_position":{"x":-29.75668,"y":553.0593},"$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"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Grapple"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"7"},"_isDisabled":true,"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"eventName":{"_value":"ForwardRay"},"value":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckEventValue`1[[System.Boolean,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"eventName":{"_value":"RightRay"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInt"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"eventName":{"_value":"LeftRay"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"4"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Grapple"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"7"},"_targetNode":{"$ref":"8"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"8"},"_targetNode":{"$ref":"0"},"_isDisabled":true,"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"619300a4-be8b-4ad4-ba2a-978468094ba2","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"forwardRay":{"_propertyPath":"PlayerMovement.forwardRay","_name":"forwardRay","_id":"a2506ca5-1b47-4820-9921-3ff4ecc18564","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.RaycastHit, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"forwardRay":{"_propertyPath":"PlayerMovement.forwardRay","_name":"forwardRay","_id":"a2506ca5-1b47-4820-9921-3ff4ecc18564","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.RaycastHit,
UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"airJumpsRemaining":{"_name":"airJumpsRemaining","_id":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d","$type":"NodeCanvas.Framework.Variable`1[[System.Int32, UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"airJumpsRemaining":{"_name":"airJumpsRemaining","_id":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d","$type":"NodeCanvas.Framework.Variable`1[[System.Int32,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"groundMoveDirection":{"_name":"groundMoveDirection","_id":"765d24b4-452d-4531-9fce-6cef7ba39634","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"rotationSpeed":{"_value":0.5,"_name":"rotationSpeed","_id":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611","$type":"NodeCanvas.Framework.Variable`1[[System.Single,
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"airMoveDirection":{"_name":"airMoveDirection","_id":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"rotationSpeed":{"_value":0.5,"_name":"rotationSpeed","_id":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611","$type":"NodeCanvas.Framework.Variable`1[[System.Single,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"jumpPower":{"_name":"jumpPower","_id":"9a82efee-e317-423c-ad6e-5ef7e6145396","$type":"NodeCanvas.Framework.Variable`1[[System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"jumpPower":{"_name":"jumpPower","_id":"9a82efee-e317-423c-ad6e-5ef7e6145396","$type":"NodeCanvas.Framework.Variable`1[[System.Single,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"gravityPower":{"_name":"gravityPower","_id":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e","$type":"NodeCanvas.Framework.Variable`1[[System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"gravityPower":{"_name":"gravityPower","_id":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e","$type":"NodeCanvas.Framework.Variable`1[[System.Single,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}}}}' mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"facingDirection":{"_value":1,"_name":"facingDirection","_id":"ff039cd9-e306-4c88-84db-54cbd3708ed5","$type":"NodeCanvas.Framework.Variable`1[[Reset.Player.Movement.PlayerFacingDirection,
Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}}}}'
_boundGraphObjectReferences: _boundGraphObjectReferences:
- {fileID: 0} - {fileID: 0}
- {fileID: 11400000, guid: b307c218c1a404548afe65e66737fa80, type: 2} - {fileID: 11400000, guid: b307c218c1a404548afe65e66737fa80, type: 2}
- {fileID: 11400000, guid: c2ae6811bd56a6245a6ab9ec1b0503ae, type: 2} - {fileID: 11400000, guid: c2ae6811bd56a6245a6ab9ec1b0503ae, type: 2}
- {fileID: 11400000, guid: f9aba4b029eacea44966829321f0124a, type: 2}
_boundGraphSource: _boundGraphSource:
_version: 3.31 _version: 3.31
_category: _category:
_comments: _comments:
_translation: {x: 542, y: 188} _translation: {x: 286, y: 482}
_zoomFactor: 0.7910043 _zoomFactor: 1
_firstActivation: 0 _firstActivation: 0
_enableAction: 0 _enableAction: 0
_disableAction: 0 _disableAction: 0

View File

@@ -5,7 +5,7 @@ using ParadoxNotion;
using ParadoxNotion.Design; using ParadoxNotion.Design;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
using Reset.Player.Movement;
namespace NodeCanvas.Tasks.Actions { namespace NodeCanvas.Tasks.Actions {
[Category("Reset/Movement")] [Category("Reset/Movement")]
@@ -13,6 +13,8 @@ namespace NodeCanvas.Tasks.Actions {
public BBParameter<float> jumpStrength; public BBParameter<float> jumpStrength;
public BBParameter<Vector3> airMoveDirection; public BBParameter<Vector3> airMoveDirection;
public BBParameter<PlayerFacingDirection> playerFacingDirection;
[Range(0f, 1f)] [Range(0f, 1f)]
public BBParameter<float> standStillJumpStrength; public BBParameter<float> standStillJumpStrength;
@@ -51,7 +53,7 @@ namespace NodeCanvas.Tasks.Actions {
// Save current velocity and get current input direction // Save current velocity and get current input direction
Vector3 currentVelocityVector3 = new Vector3(agent.velocity.x, 0f, agent.velocity.z); Vector3 currentVelocityVector3 = new Vector3(agent.velocity.x, 0f, agent.velocity.z);
Vector2 currentInput = agent.GetComponent<PlayerControls>().rawMoveInput; Vector2 currentInput = agent.GetComponent<PlayerControls>().rawMoveInput;
Vector3 currentInputVector3 = new(currentInput.x, 0f, currentInput.y); Vector3 currentInputVector3 = Camera.main.transform.rotation.Flatten(0, null, 0) * new Vector3(currentInput.x, 0f, currentInput.y);
// Ignore rotation for the current velocity // Ignore rotation for the current velocity
Vector3 currentVelocityWorld = agent.transform.InverseTransformDirection(currentVelocityVector3.normalized); Vector3 currentVelocityWorld = agent.transform.InverseTransformDirection(currentVelocityVector3.normalized);
@@ -59,7 +61,6 @@ namespace NodeCanvas.Tasks.Actions {
// Get the dot product between current velocity's direction and current input (UNUSED FOR NOW) // Get the dot product between current velocity's direction and current input (UNUSED FOR NOW)
float velocityInputDot = Vector3.Dot(currentVelocityWorld, currentInputVector3); float velocityInputDot = Vector3.Dot(currentVelocityWorld, currentInputVector3);
// Set air move direction // Set air move direction
if (agent.isGrounded) { if (agent.isGrounded) {
airMoveDirection.value = currentVelocityVector3; airMoveDirection.value = currentVelocityVector3;
@@ -93,10 +94,6 @@ namespace NodeCanvas.Tasks.Actions {
airMoveDirection.value += outputDirection * outputVelocity; airMoveDirection.value += outputDirection * outputVelocity;
} }
// Transform and apply rotatio
agent.transform.rotation = Quaternion.LookRotation(airMoveDirection.value);
EndAction(true); EndAction(true);
} }

View File

@@ -1,6 +1,8 @@
using NodeCanvas.Framework; using NodeCanvas.Framework;
using ParadoxNotion.Design; using ParadoxNotion.Design;
using UnityEngine; using UnityEngine;
using Reset.Player.Movement;
namespace NodeCanvas.Tasks.Actions { namespace NodeCanvas.Tasks.Actions {
@@ -9,6 +11,8 @@ namespace NodeCanvas.Tasks.Actions {
public BBParameter<Vector3> airMoveDirection; public BBParameter<Vector3> airMoveDirection;
public BBParameter<Vector3> groundMoveDirection; public BBParameter<Vector3> groundMoveDirection;
public BBParameter<PlayerFacingDirection> playerFacingDirection;
private float airControlPower = 1f; private float airControlPower = 1f;
//Use for initialization. This is called only once in the lifetime of the task. //Use for initialization. This is called only once in the lifetime of the task.
@@ -20,8 +24,8 @@ namespace NodeCanvas.Tasks.Actions {
//This is called once each time the task is enabled. //This is called once each time the task is enabled.
//Call EndAction() to mark the action as finished, either in success or failure. //Call EndAction() to mark the action as finished, either in success or failure.
//EndAction can be called from anywhere. //EndAction can be called from anywhere.
protected override void OnExecute() { protected override void OnExecute(){
airControlPower = 1f;
} }
//Called once per frame while the action is active. //Called once per frame while the action is active.
@@ -35,7 +39,8 @@ namespace NodeCanvas.Tasks.Actions {
// Add air control // Add air control
Vector3 inputVector3 = new(agent.GetComponent<PlayerControls>().rawMoveInput.x, 0f, agent.GetComponent<PlayerControls>().rawMoveInput.y); Vector3 inputVector3 = new(agent.GetComponent<PlayerControls>().rawMoveInput.x, 0f, agent.GetComponent<PlayerControls>().rawMoveInput.y);
float originalMagnitude = airMoveDirection.value.magnitude; float originalMagnitude = airMoveDirection.value.magnitude;
airMoveDirection.value += Camera.main.transform.rotation * inputVector3 * airControlPower; airMoveDirection.value += Camera.main.transform.rotation.Flatten(0, null, 0) *
inputVector3 * airControlPower;
airMoveDirection.value = Vector3.ClampMagnitude(airMoveDirection.value, originalMagnitude); airMoveDirection.value = Vector3.ClampMagnitude(airMoveDirection.value, originalMagnitude);
} }

View File

@@ -6,13 +6,17 @@ using ParadoxNotion.Services;
using Unity.Cinemachine; using Unity.Cinemachine;
using Unity.Mathematics; using Unity.Mathematics;
using UnityEngine; using UnityEngine;
using Reset.Player.Movement;
public enum PlayerFacingDirection{ namespace Reset.Player.Movement{
Target = 0, public enum PlayerFacingDirection{
Movement, Target = 0,
MatchCamera Movement,
MatchCamera
}
} }
namespace NodeCanvas.Tasks.Actions { namespace NodeCanvas.Tasks.Actions {
[Category("Reset/Movement")] [Category("Reset/Movement")]
@@ -28,7 +32,7 @@ namespace NodeCanvas.Tasks.Actions {
public BBParameter<float> jumpPowerDecay; public BBParameter<float> jumpPowerDecay;
// Rotation // Rotation
public PlayerFacingDirection playerFacingDirection; public BBParameter<PlayerFacingDirection> playerFacingDirection;
[ShowIf("playerFacingDirection", 0)] [ShowIf("playerFacingDirection", 0)]
public Vector3 rotationTargetPosition; public Vector3 rotationTargetPosition;
@@ -76,7 +80,7 @@ namespace NodeCanvas.Tasks.Actions {
// Calculate rotation speed // Calculate rotation speed
currentRotSpeed = Mathf.Lerp(currentRotSpeed, rotationSpeed.value, rotationSmoothing.value * Time.deltaTime); currentRotSpeed = Mathf.Lerp(currentRotSpeed, rotationSpeed.value, rotationSmoothing.value * Time.deltaTime);
switch (playerFacingDirection) { switch (playerFacingDirection.value) {
case PlayerFacingDirection.Target: case PlayerFacingDirection.Target:
// Set rotation to just the direction of the target // Set rotation to just the direction of the target
targetRotation = Quaternion.LookRotation((agent.transform.position.DirectionTo(rotationTargetPosition)).Flatten(null, 0, null)); targetRotation = Quaternion.LookRotation((agent.transform.position.DirectionTo(rotationTargetPosition)).Flatten(null, 0, null));
@@ -97,9 +101,6 @@ namespace NodeCanvas.Tasks.Actions {
break; break;
} }
// Set final rotation
agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, targetRotation, 10f * Time.deltaTime);
// Construct move direction // Construct move direction
Vector3 finalMoveDir = Vector3.zero; Vector3 finalMoveDir = Vector3.zero;
Vector3 gravityMoveDirection; Vector3 gravityMoveDirection;
@@ -125,6 +126,9 @@ namespace NodeCanvas.Tasks.Actions {
agent.Move((finalMoveDir + gravityMoveDirection) * Time.deltaTime); agent.Move((finalMoveDir + gravityMoveDirection) * Time.deltaTime);
} }
// Set final rotation
agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, targetRotation, 10f * Time.deltaTime);
// ???? Moved this above but don't remember if this needs to be here still // ???? Moved this above but don't remember if this needs to be here still
if (agent.isGrounded) { if (agent.isGrounded) {
jumpPower.value = 0f; jumpPower.value = 0f;

View File

@@ -0,0 +1,56 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Actions {
[Category("Reset")]
[Description("Hard set the air direction to a certain direction")]
public class SetAirMovement : ActionTask<Transform>{
public BBParameter<Vector3> airMoveDirection;
public BBParameter<Vector3> inputVector3;
public Space fromSpace;
public Space toSpace;
//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() {
return null;
}
//This is called once each time the task is enabled.
//Call EndAction() to mark the action as finished, either in success or failure.
//EndAction can be called from anywhere.
protected override void OnExecute(){
}
//Called once per frame while the action is active.
protected override void OnUpdate() {
if (fromSpace == toSpace) {
airMoveDirection.value = inputVector3.value;
}
// NOTE: I swear to God these absolutely do not work and nobody could convince me otherwise
if (fromSpace == Space.World){
airMoveDirection.value = Camera.main.transform.rotation.Flatten(0, null, 0) * inputVector3.value;
} else {
airMoveDirection.value = Camera.main.transform.rotation.Flatten(0, null, 0) * agent.InverseTransformVector(inputVector3.value);
}
EndAction(true);
}
//Called when the task is disabled.
protected override void OnStop() {
}
//Called when the task is paused.
protected override void OnPause() {
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f1db555b92ed94543beab7a2106bc2a3