change: altered camera for smoother and more responsive lock-on (mainly jitter from the arbitrary target, locking rotation)

This commit is contained in:
Chris
2025-08-06 15:23:42 -04:00
parent 18a4b5228a
commit 9e8616f8da
13 changed files with 185 additions and 53 deletions

View File

@@ -27,7 +27,7 @@ namespace NodeCanvas.Tasks.Actions {
public TransformProperty targetProperty;
[ParadoxNotion.Design.ShowIf("targetProperty", 0), Space(5)]
[ParadoxNotion.Design.ShowIf("targetProperty", 1), Space(5)]
public BBParameter<bool> forcePositionChange;
public BBParameter<Vector3> targetValue;

View File

@@ -36,6 +36,7 @@ public enum CameraSettingsToggle{
NoChange,
NewValue,
ResetValue,
RelativeValue, // Placeholder for using as altering existing value
}
public interface ICameraValueGroup{
@@ -121,7 +122,7 @@ public class BoolCameraValueGroupDrawer : ObjectDrawer<BoolCameraValueGroup> {
// 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.Label(_instance.label, labelOptions);
GUILayout.BeginHorizontal();
// Create the x settings enum
@@ -164,7 +165,7 @@ public class FloatCameraValueGroupDrawer : ObjectDrawer<FloatCameraValueGroup>
// 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.Label(_instance.label, labelOptions);
GUILayout.BeginHorizontal();
// Create the x settings enum
@@ -431,7 +432,9 @@ namespace NodeCanvas.Tasks.Actions {
UpdateFloatValue(axisLookXGain, ref CameraSettingsProcessor.values.axisLookGainX);
UpdateFloatValue(axisLookYGain, ref CameraSettingsProcessor.values.axisLookGainY);
UpdateBoolValue(enableXAxis, ref CameraSettingsProcessor.values.axisLookEnabledX);
UpdateBoolValue(enableYAxis, ref CameraSettingsProcessor.values.axisLookEnabledY);
EndAction(true);

View File

@@ -104,6 +104,9 @@ namespace Reset {
observer.DrawObserverGizmo(agent.gameObject, true);
}
if (check && !outputHit.isNoneOrNull) {
outputHit.value = observer.hit;
}
return check;
}
}

View File

@@ -19,6 +19,11 @@ namespace NodeCanvas.Tasks.Actions {
//Use for initialization. This is called only once in the lifetime of the task.
//Return null if init was successfull. Return an error string otherwise
protected override string info{
get{ return $"Decompose RaycastHit <b>{raycastHit}</b>"; }
}
protected override string OnInit() {
return null;
}

View File

@@ -0,0 +1,65 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using ParadoxNotion.Serialization.FullSerializer;
using UnityEngine;
using Logger = ParadoxNotion.Services.Logger;
namespace NodeCanvas.Tasks.Actions {
[Category("Reset")]
public class UpdateObjectCameraTracking : ActionTask<LockOnManager> {
public BBParameter<GameObject> relatedObject;
enum CameraTrackingTaskAction{
AddOrUpdate,
Remove
}
[ExposeField, fsSerializeAs, Space(5)]
CameraTrackingTaskAction action;
[ParadoxNotion.Design.ShowIf("action", 0)]
public BBParameter<float> weight;
[ParadoxNotion.Design.ShowIf("action", 0)]
public BBParameter<bool> isMain;
//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() {
if (relatedObject.isNull) {
Logger.LogError("There is no object for the camera to add to tracking. May have forgotten a reference/object probably destroyed?");
EndAction(false);
return;
}
if (action == CameraTrackingTaskAction.AddOrUpdate) {
agent.AddNewTarget(relatedObject.value, weight.value, isMain.value);
} else {
agent.QueueTargetRemoval(relatedObject.value);
}
EndAction(true);
}
//Called once per frame while the action is active.
protected override void OnUpdate() {
}
//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: c187e5f8e4ad16b42b10c10ea9fb8fd4