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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Skip Input Mesh if spline has too much bend Zilk1 3 5 09-27-2023, 09:45 PM
Last Post: _Aka_
  animating points on a spline Antonio 11 18 09-17-2023, 09:55 AM
Last Post: _Aka_
  Getting object on spline Position when Spline has coordinates larger than 2000 velikizlivuk 5 8 09-05-2023, 01:01 PM
Last Post: velikizlivuk
  Spline.Length not updated unless I add a point to spline (or modify it) first. _RicO 3 6 08-26-2023, 08:41 AM
Last Post: _Aka_

Forum Jump: