03-15-2018, 08:02 PM
I have got a situation where I'm animating a CurvySpline using Bezier interpolation in code. Every frame during the sequence both the control points and the handles are modified. I kept seeing extremely strange and undesired shapes when I have the animation using a Coroutine to advance, but when I set it up to be something I could scrub from the inspector, it looked correct.
Finally I discovered that the scrubbing was actually obscuring the issue. What I found out after setting up my tests in a certain way where I could change the curve and step over frames is that the Bezier curve seems to take 3-4 frames before it actually resolves to how it is supposed to look. This is really strange behavior. I could understand it taking one frame due to script execution order, but I can't understand why it would take multiple frames beyond that.
I really need a way to instantly get the Bezier curve to recalculate properly without waiting for a frame. In my class that modifies the control points and handles, I added SetDirtyAll() and Refresh() to the end of the function hoping that this would force Curvy to recalculate the curve, but it doesn't actually change anything.
I could use some pointers on how I can make sure that the whole curve is re-evaluated immediately after I change its control points and handles in code.
Thanks.
Finally I discovered that the scrubbing was actually obscuring the issue. What I found out after setting up my tests in a certain way where I could change the curve and step over frames is that the Bezier curve seems to take 3-4 frames before it actually resolves to how it is supposed to look. This is really strange behavior. I could understand it taking one frame due to script execution order, but I can't understand why it would take multiple frames beyond that.
I really need a way to instantly get the Bezier curve to recalculate properly without waiting for a frame. In my class that modifies the control points and handles, I added SetDirtyAll() and Refresh() to the end of the function hoping that this would force Curvy to recalculate the curve, but it doesn't actually change anything.
I could use some pointers on how I can make sure that the whole curve is re-evaluated immediately after I change its control points and handles in code.
Thanks.