Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Control of an object that uses a spline
#1
If I have an object using a Spline Controller for movement, is there a way to remove the object from the spline's movement control temporarily or permanently?  For example, suppose I've got a ship using a spline for movement but want to evade a shot by the player with some other movement algorithm.  I've tried the following ways but have issues with each of them, I'm hoping I'm just missing something. Smile  I'm doing these when the controller raises the OnEndReached event for the spline.

  • Stop the spline controller - when I try to change the transform position of the object, the spline controller still makes it stay on the path.
  • Disable the spline controller in code - when I try to change the transform position of the object, the spline controller still makes it stay on the path.  Maybe because I'm trying to do the movement in the same frame as when I disable the controller?
  • Remove the current spline from the controller (i.e. controller.Spline = null) - This allows me to change the object's transform position, but it makes the controller angry and throws an error... I'm assuming this occurs because the spline is technically still in use.  Details below:

NullReferenceException: Object reference not set to an instance of an object
FluffyUnderware.Curvy.Controllers.SplineController.MovementCompatibleGetPosition (FluffyUnderware.Curvy.Controllers.SplineController controller, FluffyUnderware.Curvy.CurvyPositionMode positionMode, FluffyUnderware.Curvy.CurvySplineSegment& controlPoint, System.Boolean& isOnControlPoint, System.Single clampedPosition) (at Assets/Standard Assets/Curvy/Curvy/Controllers/SplineController.cs:603)
FluffyUnderware.Curvy.Controllers.SplineController.InvokeEventHandler (FluffyUnderware.Curvy.Controllers.CurvySplineMoveEvent event, FluffyUnderware.Curvy.Controllers.CurvySplineMoveEventArgs eventArgument, FluffyUnderware.Curvy.CurvyPositionMode positionMode, FluffyUnderware.Curvy.CurvySplineSegment& postEventsControlPoint, System.Boolean& postEventsIsControllerOnControlPoint, System.Single& postEventsControlPointPosition) (at Assets/Standard Assets/Curvy/Curvy/Controllers/SplineController.cs:937)
FluffyUnderware.Curvy.Controllers.SplineController.HandleReachingNewControlPoint (FluffyUnderware.Curvy.CurvySplineSegment controlPoint, System.Single controlPointPosition, FluffyUnderware.Curvy.CurvyPositionMode positionMode, System.Single currentDelta, System.Boolean& cancelMovement, FluffyUnderware.Curvy.CurvySplineSegment& postEventsControlPoint, System.Boolean& postEventsIsControllerOnControlPoint, System.Single& postEventsControlPointPosition) (at Assets/Standard Assets/Curvy/Curvy/Controllers/SplineController.cs:921)
FluffyUnderware.Curvy.Controllers.SplineController.EventAwareMove (System.Single distance) (at Assets/Standard Assets/Curvy/Curvy/Controllers/SplineController.cs:786)
FluffyUnderware.Curvy.Controllers.SplineController.Advance (System.Single speed, System.Single deltaTime) (at Assets/Standard Assets/Curvy/Curvy/Controllers/SplineController.cs:494)
FluffyUnderware.Curvy.Controllers.CurvyController.InitializedApplyDeltaTime (System.Single deltaTime) (at Assets/Standard Assets/Curvy/Curvy/Controllers/CurvyController.cs:675)
FluffyUnderware.Curvy.Controllers.SplineController.InitializedApplyDeltaTime (System.Single deltaTime) (at Assets/Standard Assets/Curvy/Curvy/Controllers/SplineController.cs:538)
FluffyUnderware.Curvy.Controllers.CurvyController.ApplyDeltaTime (System.Single deltaTime) (at Assets/Standard Assets/Curvy/Curvy/Controllers/CurvyController.cs:1014)
FluffyUnderware.Curvy.Controllers.CurvyController.Update () (at Assets/Standard Assets/Curvy/Curvy/Controllers/CurvyController.cs:605)


Any thoughts would be appreciated.  Thanks for your help.
Reply


Messages In This Thread
Control of an object that uses a spline - by ricke - 09-14-2021, 04:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 13 03-04-2024, 11:06 AM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  Keeping a fixed spline length jh092 3 16 02-21-2024, 06:25 AM
Last Post: Primrose44

Forum Jump: