Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Animating a shape on along a spline will not playback in scene or game views
#1
Hi, I am new to Curvy Splines and have gone through the tutorials to understand how to create splines and generators. I can achieve the creation of a spline and also the creation of a Generator which extrudes a shape along that spline path.

This all works as expected, but when I try to animate the "Shape Extrusion: Build Shape Extrusion.Range.To" Property in the Unity Animation Timeline (I am attaching the animation to the Generator asset), both in the Scene and Game views the animation is not displaying. 

If I manual slide the Range property in the Inspector I can see the desired effect I need, but it will not playback when I click on play in the Animation timeline or the game view. When I play the Scene, I can see the Shape Extrusion: Build Shape Extrusion.Range.To property changing its values in the Inspector panel (as required) but still the extrusion is not animating in the game.

I am building a AR app with a Vuforia AR Camera, and I thought that this might be a problem but I created a new project without Vuforia and imported Curvy Splines 8.6.0 and test the same method on the 28_AsteroidBelt scene, trying to animate the Rasterise Path Length property but it is doing the same thing, nothing is animating when playing the scene. 

I am using Unity 2022.2.16 Editor.

Am I doing something wrong, or am I missing a step?

Any help greatly appreciated.


Attached Files Thumbnail(s)
               
Reply
#2
Hi

TL;DR:
Add this script to your module:
Code:
using FluffyUnderware.Curvy.Generator;
using UnityEngine;

public class Dirtier : MonoBehaviour
{
    void Update() =>
        GetComponent<CGModule>().Dirty = true;
}



The issue is that the animator seems to not call Unity's OnValidate when changing the value of a property. OnValidate is where the module gets dirty, meaning that the module is marked as needing to trigger a refresh of the generator. So no OnValidate -> no dirtying -> no refreshing.
The script provided will artificially dirty the module at every update. Disable the script if you are not animating the module, since that will lead to unnecessary updates generator.
You can use a similar that will dirty the whole generator (CurvyGenerator.Dirty) instead of a single module.

Did this help?
If and when you feel like it, please leave a review for the asset, that helps a lot
Have a nice day
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
(05-01-2023, 11:16 AM)_Aka_ Wrote: Hi

TL;DR:
Add this script to your module:
Code:
using FluffyUnderware.Curvy.Generator;
using UnityEngine;

public class Dirtier : MonoBehaviour
{
    void Update() =>
        GetComponent<CGModule>().Dirty = true;
}



The issue is that the animator seems to not call Unity's OnValidate when changing the value of a property. OnValidate is where the module gets dirty, meaning that the module is marked as needing to trigger a refresh of the generator. So no OnValidate -> no dirtying -> no refreshing.
The script provided will artificially dirty the module at every update. Disable the script if you are not animating the module, since that will lead to unnecessary updates generator.
You can use a similar that will dirty the whole generator (CurvyGenerator.Dirty) instead of a single module.

Did this help?
If and when you feel like it, please leave a review for the asset, that helps a lot
Have a nice day

This worked, can't believe I was thinking along the same lines as what the solution was but didn't know how to call .dirty(). In my mind I knew that it would have been a refereshing issue. Thanks again.
Reply
#4
You are welcome.
You can also call the Refresh(true) method of the generator, but that's overkill, since it will force every module to recompute its result.
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Method of scattering objects along spline joebain 1 3 11-26-2024, 03:20 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 5 13 10-29-2024, 10:19 AM
Last Post: _Aka_
  Scene 51: Dynamic track between two points wallflower6 3 8 08-19-2024, 08:18 AM
Last Post: _Aka_
  Nested Spline Volume Spot Instantiation merobbins5 3 7 07-26-2024, 09:58 AM
Last Post: _Aka_

Forum Jump: