@@ -110,6 +110,18 @@ private void Awake()
110110 {
111111 // Start off as disabled
112112 enabled = false ;
113+
114+ // Update manipulator inside brain state
115+ _probeController . MovedThisFrameEvent . AddListener ( ( ) =>
116+ {
117+ if ( _isSetToInsideBrain != _probeManager . IsProbeInBrain ( ) )
118+ CommunicationManager . Instance . SetInsideBrain ( ManipulatorID , _probeManager . IsProbeInBrain ( ) ,
119+ insideBrain =>
120+ {
121+ _isSetToInsideBrain = insideBrain ;
122+ _probeController . UnlockedDir = insideBrain ? new Vector4 ( 0 , 0 , 0 , 1 ) : Vector4 . one ;
123+ } ) ;
124+ } ) ;
113125 }
114126
115127 private void OnDisable ( )
@@ -197,6 +209,7 @@ public bool IsRightHanded
197209 private bool _isSetToDropToSurfaceWithDepth = true ;
198210 private bool _isRightHanded ;
199211 private float _lastLoggedTime ;
212+ private bool _isSetToInsideBrain ;
200213
201214 #endregion
202215
@@ -364,22 +377,13 @@ public void MoveByWorldSpaceDelta(Vector4 worldSpaceDelta, Action<bool> onSucces
364377 {
365378 // Process depth movement
366379 var targetDepth = newPos . w + manipulatorSpaceDepth ;
367- CommunicationManager . Instance . SetInsideBrain (
368- ManipulatorID , true , _ =>
380+ // Move the manipulator
381+ CommunicationManager . Instance . DriveToDepth (
382+ ManipulatorID , targetDepth , AUTOMATIC_MOVEMENT_SPEED ,
383+ _ =>
369384 {
370- // Move the manipulator
371- CommunicationManager . Instance . DriveToDepth (
372- ManipulatorID , targetDepth , AUTOMATIC_MOVEMENT_SPEED ,
373- _ =>
374- {
375- CommunicationManager . Instance . SetInsideBrain (
376- ManipulatorID , false ,
377- _ =>
378- {
379- CommunicationManager . Instance . SetCanWrite ( ManipulatorID , false , 0 ,
380- onSuccessCallback , onErrorCallback ) ;
381- } , onErrorCallback ) ;
382- } , onErrorCallback ) ;
385+ CommunicationManager . Instance . SetCanWrite ( ManipulatorID , false , 0 ,
386+ onSuccessCallback , onErrorCallback ) ;
383387 } , onErrorCallback ) ;
384388 } , onErrorCallback ) ;
385389 } , onErrorCallback ) ;
0 commit comments