Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Kinematica: Raise events at specific animation frame?

Discussion in 'Animation Previews' started by b4gn0, Nov 6, 2020.

  1. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    119
    The "classic" animation package offered a way to raise event / send messages at specific frames during animation (e.g. to raise dust / play sound on player foot contact with ground).

    Is there any way to do the same using Kinematica?

    Thank you
     
  2. grahamsaulnier

    grahamsaulnier

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    18
    We do not presently support animation events in Kinematica.

    If you import the Hello World sample from the package manager there's Readme.md which includes some sample for for using markers to execute code at certain frames. You might be able to work with custom marker definitions to perform some similar actions to events.

    Code (CSharp):
    1. [Trait]
    2. [BurstCompile]
    3. public struct RewindMarkerPayload : Trait {
    4.     public void Execute(ref MotionSynthesizer synthesizer)
    5.     {
    6.         synthesizer.Push(synthesizer.Rewind(synthesizer.Time));
    7.     }
    8.  
    9.     [BurstCompile]
    10.     public static void ExecuteSelf(ref RewindMarkerPayload p, ref MotionSynthesizer synthesizer)
    11.     {
    12.         p.Execute(ref synthesizer);
    13.     }
    14. }
    Hope this provides an acceptable workaround while we investigate animation event support in Kinematica.
     
    b4gn0 likes this.