fixed: various movement and air control fixes and tweaks, various clean up

This commit is contained in:
Chris
2025-07-29 17:38:52 -04:00
parent 39313c96d0
commit ae1908013d
9 changed files with 52 additions and 37 deletions

View File

@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7a686a47eee2fa44cb0a34b5d86e4d5e, type: 3} m_Script: {fileID: 11500000, guid: 7a686a47eee2fa44cb0a34b5d86e4d5e, type: 3}
m_Name: GroundedCheckBT m_Name: GroundedCheckBT
m_EditorClassIdentifier: 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"}}' _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"},{"_position":{"x":522.0,"y":632.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"3"},{"_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":399.0,"y":775.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"4"},{"_action":{"airMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},"inputVector3":{},"$type":"NodeCanvas.Tasks.Actions.SetAirMovement"},"_position":{"x":576.0,"y":776.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"5"},{"_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":"6"}],"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":"6"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}'
_objectReferences: [] _objectReferences: []
_graphSource: _graphSource:
_version: 3.31 _version: 3.31

View File

@@ -12,16 +12,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f945e777233a59f4aba40aeca29093a6, type: 3} m_Script: {fileID: 11500000, guid: f945e777233a59f4aba40aeca29093a6, type: 3}
m_Name: PlayerLocomotionFSM m_Name: PlayerLocomotionFSM
m_EditorClassIdentifier: m_EditorClassIdentifier:
_serializedGraph: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":10.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":0.3},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":559.9924,"y":711.7622},"$type":"NodeCanvas.StateMachines.ActionState","$id":"0"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":15.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":0.2},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":1161.288,"y":522.152},"$type":"NodeCanvas.StateMachines.ActionState","$id":"1"},{"_position":{"x":430.6569,"y":381.1322},"$type":"NodeCanvas.StateMachines.AnyState","$id":"2"},{"_position":{"x":465.0,"y":561.0},"$type":"NodeCanvas.StateMachines.EmptyState","$id":"3"}],"connections":[{"_condition":{"actionName":{"_value":"Sprint"},"actionValue":{"_value":""},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"desiredVector3":{"_value":{"z":1.0}},"tolerance":{"_value":0.5},"negate":{},"$type":"NodeCanvas.Tasks.Conditions.GetMovementInputDotProduct"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"321e55c7-f93e-4667-a0dc-559eb61c6898","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean, _serializedGraph: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":12.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":10.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"},{"valueA":{"_name":"facingDirection","_targetVariableID":"c713d622-aafb-43e7-ae0e-ac0b86a85a37"},"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[Reset.Player.Movement.PlayerFacingDirection,
Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":559.9924,"y":711.7622},"$type":"NodeCanvas.StateMachines.ActionState","$id":"0"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":30.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":1.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"},{"valueA":{"_name":"facingDirection","_targetVariableID":"c713d622-aafb-43e7-ae0e-ac0b86a85a37"},"valueB":{"_value":2},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[Reset.Player.Movement.PlayerFacingDirection,
Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":916.0607,"y":852.7302},"$type":"NodeCanvas.StateMachines.ActionState","$id":"1"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":20.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":2.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":1161.288,"y":522.152},"$type":"NodeCanvas.StateMachines.ActionState","$id":"2"},{"_position":{"x":430.6569,"y":381.1322},"$type":"NodeCanvas.StateMachines.AnyState","$id":"3"},{"_position":{"x":465.0,"y":561.0},"$type":"NodeCanvas.StateMachines.EmptyState","$id":"4"}],"connections":[{"_condition":{"actionName":{"_value":"Sprint"},"actionValue":{"_value":""},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"timeout":{"_value":0.1},"$type":"NodeCanvas.Tasks.Conditions.Timeout"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"desiredVector3":{"_value":{"z":1.0}},"tolerance":{"_value":0.5},"negate":{},"$type":"NodeCanvas.Tasks.Conditions.GetMovementInputDotProduct"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"4"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"321e55c7-f93e-4667-a0dc-559eb61c6898","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"groundMoveDirection":{"_name":"groundMoveDirection","_id":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"groundMoveDirection":{"_name":"groundMoveDirection","_id":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"rotationSpeed":{"_name":"rotationSpeed","_id":"d888730f-97df-4288-bb99-1f6c8a34a7c5","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[System.Single, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"rotationSpeed":{"_name":"rotationSpeed","_id":"d888730f-97df-4288-bb99-1f6c8a34a7c5","_isPublic":true,"$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":{"_name":"facingDirection","_id":"c713d622-aafb-43e7-ae0e-ac0b86a85a37","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[Reset.Player.Movement.PlayerFacingDirection,
Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}}}}'
_objectReferences: [] _objectReferences: []
_graphSource: _graphSource:
_version: 3.31 _version: 3.31
_category: _category:
_comments: _comments:
_translation: {x: 21, y: -46} _translation: {x: -337, y: -84}
_zoomFactor: 0.9967056 _zoomFactor: 1
_haltSerialization: 0 _haltSerialization: 0
_externalSerializationFile: {fileID: 0} _externalSerializationFile: {fileID: 0}

File diff suppressed because one or more lines are too long

View File

@@ -19,8 +19,6 @@ namespace NodeCanvas.Tasks.Actions {
[SliderField(0, 1)] [SliderField(0, 1)]
public BBParameter<float> standStillJumpStrength; public BBParameter<float> standStillJumpStrength;
[Tooltip("Determines how much current movement vectors into jump direction")] [Tooltip("Determines how much current movement vectors into jump direction")]
[SliderField(0, 1)] [SliderField(0, 1)]
public BBParameter<float> currentVelocityInheritence; public BBParameter<float> currentVelocityInheritence;

View File

@@ -3,16 +3,13 @@ using ParadoxNotion.Design;
using UnityEngine; using UnityEngine;
using Reset.Player.Movement; using Reset.Player.Movement;
namespace NodeCanvas.Tasks.Actions { namespace NodeCanvas.Tasks.Actions {
[Category("Reset/Movement")] [Category("Reset/Movement")]
public class CalculateAirMovement : ActionTask<Transform>{ public class CalculateAirMovement : ActionTask<Transform>{
public BBParameter<Vector3> airMoveDirection; public BBParameter<Vector3> airMoveDirection;
public BBParameter<Vector3> groundMoveDirection; public BBParameter<Vector3> groundMoveDirection; // Unused on 7/29/25, delete if still unusued later
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.
@@ -25,7 +22,7 @@ namespace NodeCanvas.Tasks.Actions {
//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.
@@ -34,7 +31,7 @@ namespace NodeCanvas.Tasks.Actions {
airMoveDirection.value = Vector3.Lerp(airMoveDirection.value, Vector3.zero, .7f * Time.deltaTime); airMoveDirection.value = Vector3.Lerp(airMoveDirection.value, Vector3.zero, .7f * Time.deltaTime);
// Decay Air Control power // Decay Air Control power
airControlPower = Mathf.Lerp(airControlPower, 0f, 3f * Time.deltaTime); airControlPower = Mathf.Lerp(airControlPower, 0f, 2f * Time.deltaTime);
// 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);
@@ -47,7 +44,7 @@ namespace NodeCanvas.Tasks.Actions {
//Called when the task is disabled. //Called when the task is disabled.
protected override void OnStop() { protected override void OnStop() {
groundMoveDirection.value = agent.GetComponent<CharacterController>().velocity; // groundMoveDirection.value = agent.GetComponent<CharacterController>().velocity;
EndAction(true); EndAction(true);
} }

View File

@@ -66,7 +66,7 @@ namespace NodeCanvas.Tasks.Actions {
break; break;
case TransformProperty.Rotation: case TransformProperty.Rotation:
// agent.transform = Quaternion.Euler(relativeValue.value + targetValue.value); agent.transform.rotation = Quaternion.LookRotation(relativeValue.value) * Quaternion.Euler(targetValue.value);
break; break;
case TransformProperty.Scale: case TransformProperty.Scale:
break; break;
@@ -99,7 +99,7 @@ namespace NodeCanvas.Tasks.Actions {
break; break;
case TransformProperty.Rotation: case TransformProperty.Rotation:
agent.transform.rotation = Quaternion.Euler(relativeValue.value + targetValue.value); agent.transform.rotation = Quaternion.Euler(relativeValue.value) * Quaternion.Euler(targetValue.value);
break; break;
case TransformProperty.Scale: case TransformProperty.Scale:
break; break;

View File

@@ -44,6 +44,7 @@ namespace NodeCanvas.Tasks.Actions {
private float currentRotSpeed; private float currentRotSpeed;
private float lastLookMagnitude; private float lastLookMagnitude;
private Quaternion targetRotation; private Quaternion targetRotation;
private Vector3 currentMoveDir;
// References // References
private PlayerControls controls; private PlayerControls controls;
@@ -56,7 +57,7 @@ namespace NodeCanvas.Tasks.Actions {
// Append the late update method to actually happen on late update // Append the late update method to actually happen on late update
MonoManager.current.onLateUpdate += LateUpdate; MonoManager.current.onLateUpdate += LateUpdate;
// What // Set ingitial rotation power
currentRotSpeed = rotationSpeed.value; currentRotSpeed = rotationSpeed.value;
// Reference to controls // Reference to controls
@@ -68,8 +69,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(){
currentMoveDir = groundMoveDirection.value;
} }
//Called once per frame while the action is active. //Called once per frame while the action is active.
@@ -92,8 +93,12 @@ namespace NodeCanvas.Tasks.Actions {
if (controls.rawMoveInput.magnitude == 0) { break; } if (controls.rawMoveInput.magnitude == 0) { break; }
// Set desired rotation to input direction, with respect to camera rotation // Set desired rotation to input direction, with respect to camera rotation
targetRotation = Quaternion.LookRotation(new Vector3(controls.rawMoveInput.x, 0, controls.rawMoveInput.y)) * if (agent.isGrounded){
Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0f, null, 0f)); targetRotation = Quaternion.LookRotation(currentMoveDir) *
Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0f, null, 0f));
} else {
targetRotation = Quaternion.LookRotation(airMoveDirection.value);
}
break; break;
case PlayerFacingDirection.MatchCamera: case PlayerFacingDirection.MatchCamera:
// Craft a new rotation that flattens the camera's rotation to the ground // Craft a new rotation that flattens the camera's rotation to the ground
@@ -108,10 +113,13 @@ namespace NodeCanvas.Tasks.Actions {
// Construct move direction // Construct move direction
Vector3 finalMoveDir = Vector3.zero; Vector3 finalMoveDir = Vector3.zero;
Vector3 gravityMoveDirection; Vector3 gravityMoveDirection;
// Change how input is managed based on facing state
currentMoveDir = Vector3.Slerp(currentMoveDir, groundMoveDirection.value, currentRotSpeed * Time.deltaTime);
// Add input movement // Add input movement
if (agent.isGrounded){ if (agent.isGrounded){
finalMoveDir += groundMoveDirection.value + Vector3.down * .03f; finalMoveDir += currentMoveDir + Vector3.down * .03f;
gravityMoveDirection = new(0f, jumpPower.value + (Physics.gravity.y *.3f), 0f); gravityMoveDirection = new(0f, jumpPower.value + (Physics.gravity.y *.3f), 0f);
} else { } else {
finalMoveDir += airMoveDirection.value; finalMoveDir += airMoveDirection.value;
@@ -131,7 +139,7 @@ namespace NodeCanvas.Tasks.Actions {
} }
// Set final rotation // Set final rotation
agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, targetRotation, 10f * Time.deltaTime); agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, targetRotation, 10f * Time.deltaTime).Flatten(0, null, 0);
// ???? 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) {

View File

@@ -113,6 +113,8 @@ public class CameraSettingsProcessor : MonoBehaviour{
values.orbitFollowCenterHeight.targetValue, ref values.orbitFollowCenterHeight.velocityRef, values.orbitFollowCenterHeight.targetValue, ref values.orbitFollowCenterHeight.velocityRef,
values.orbitFollowCenterHeight.smoothing); values.orbitFollowCenterHeight.smoothing);
orbit.Orbits.Center.Radius = Mathf.SmoothDamp(orbit.Orbits.Center.Radius, orbit.Orbits.Center.Radius = Mathf.SmoothDamp(orbit.Orbits.Center.Radius,
values.orbitFollowCenterRadius.targetValue, ref values.orbitFollowCenterRadius.velocityRef, values.orbitFollowCenterRadius.targetValue, ref values.orbitFollowCenterRadius.velocityRef,
values.orbitFollowCenterRadius.smoothing); values.orbitFollowCenterRadius.smoothing);

View File

@@ -124,7 +124,7 @@
{ {
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastSize.Cube", "key": "ShapeBuilder.LastSize.Cube",
"value": "{\"m_Value\":{\"x\":20.036033630371095,\"y\":1.0208016633987427,\"z\":-17.9393310546875}}" "value": "{\"m_Value\":{\"x\":53.82322311401367,\"y\":3.7740979194641115,\"z\":159.09600830078126}}"
}, },
{ {
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",