diff --git a/src/Extensions.csproj b/src/Extensions.csproj index 24de266..a702740 100644 --- a/src/Extensions.csproj +++ b/src/Extensions.csproj @@ -1,15 +1,16 @@ - net472 + net48 true - + + \ No newline at end of file diff --git a/src/Extensions/ModifyManipulatorPosition.cs b/src/Extensions/ModifyManipulatorPosition.cs new file mode 100644 index 0000000..738c6d1 --- /dev/null +++ b/src/Extensions/ModifyManipulatorPosition.cs @@ -0,0 +1,27 @@ +using Bonsai; +using System; +using System.ComponentModel; +using System.Linq; +using System.Reactive.Linq; +using AllenNeuralDynamics.AindManipulator; + +[Combinator] +[Description("Modifies a single axis of the ManipulatorPosition object given a specified value.")] +[WorkflowElementCategory(ElementCategory.Transform)] +public class ModifyManipulatorPosition +{ + public Axis Axis { get; set; } + public IObservable Process(IObservable> source) + { + return source.Select(value => { + var newPosition = new ManipulatorPosition(){ + X = value.Item1.X, + Y1 = value.Item1.Y1, + Y2 = value.Item1.Y2, + Z = value.Item1.Z + }; + newPosition[Axis] = value.Item2; + return newPosition; + }); + } +} diff --git a/src/vr-foraging.bonsai b/src/vr-foraging.bonsai index 989a0c7..ffafeac 100644 --- a/src/vr-foraging.bonsai +++ b/src/vr-foraging.bonsai @@ -3513,18 +3513,21 @@ Item3 as Right) RetractingDistance - - SpoutAxis - - - Assign - Item1[Item3] = Item2 + + SpoutAxis - - Item1 + + + + + + + + None + @@ -3546,13 +3549,13 @@ Item3 as Right) - + - - + + - +