maint: various clean up, movement tweaks, and smoothing fixes

This commit is contained in:
Chris
2025-09-29 21:10:22 -04:00
parent 535aa1797d
commit 8f3ea1a491
22 changed files with 56677 additions and 1661 deletions

View File

@@ -8,14 +8,15 @@ namespace Reset.Units {
[Category("Reset/Movement")]
[Description("Set a new rotation value for this agent, either additively, absolutely, or relatively.")]
public class SetNewRotation : ActionTask<UnitMovementHandler> {
public BBParameter<Quaternion> newRotation;
public BBParameter<Vector3> newRotation;
[Tooltip("Setting absolute to true will cause the resolved movement rotation to snap to the new gravity value. Keeping it false will make it apply additively to the resolved movement rotation. Both options use relativty for linear interpolation.")]
public BBParameter<bool> absolute;
[Tooltip("Higher relativity means more of the new value is used. Value of 1 will set it to the value directly, while .5 will blend halfway between.")]
[SliderField(0, 1)]
public BBParameter<float> relativity;
public BBParameter<Quaternion> relativeTo;
public BBParameter<Vector3> relativeTo;
public BBParameter<bool> relativeToIsDirection;
//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
@@ -27,7 +28,11 @@ namespace Reset.Units {
//Call EndAction() to mark the action as finished, either in success or failure.
//EndAction can be called from anywhere.
protected override void OnExecute() {
agent.SetNewRotation(newRotation.value, relativity.value, absolute.value, relativeTo.value);
if (relativeToIsDirection.value) {
agent.SetNewRotation(Quaternion.Euler(newRotation.value), relativity.value, absolute.value, Quaternion.Euler(relativeTo.value));
} else {
agent.SetNewRotation(Quaternion.Euler(newRotation.value), relativity.value, absolute.value, Quaternion.LookRotation(relativeTo.value));
}
EndAction(true);
}