change: altered camera for smoother and more responsive lock-on (mainly jitter from the arbitrary target, locking rotation)
This commit is contained in:
@@ -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() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user