Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set SplineController position from code
I am simply trying to set the SplineController position (along the spline) from code. I want to be able to control it with a 0-1 value. I thought that this would work, but it doesn't:

splineController.Position = moveValue;

there is no error, it just doesn't do anything. The spline variable is set properly. I've tried changing the move mode and position mode and nothing works, please help
This should work. Note that setting Position (or RelativePosition) works only if the controller is running! If not running, use InitialPosition!
I finally fixed it, I found that I had to adjust the animation settings to:

splineController.MoveMode = CurvyController.MoveModeEnum.Relative;
splineController.Speed = .1f;
splineController.Clamping = CurvyClamping.Clamp;
splineController.PlayAutomatically = true;
splineController.AdaptOnChange = true;
splineController.Animate = false;

It's a little unintuitive that I had to set the animation settings like that. The connection to setting the position in script is not clear. I would prefer a toggle like "SetPositionFromScript" or something like that
The important line above is "MoveMode", because Position is set according to that mode. If you want to set relative position regardless of MoveMode, use "RelativePosition"!

Possibly Related Threads…
Thread Author Replies Views Last Post
Video How do I merge splines only if some control points are at the sam position? arcade.autumn 5 14 02-13-2023, 09:35 AM
Last Post: _Aka_
  Permission to publish custom CGModule source code? Apelsin 6 9,419 09-15-2022, 08:53 PM
Last Post: Josaf Tom
Photo Position in Input Spots not working on all directions. Mike Danielsson 2 9 09-03-2022, 02:22 PM
Last Post: Mike Danielsson
  TF to world position niuage 2 9 03-06-2022, 08:16 AM
Last Post: niuage

Forum Jump: