Jump to content

How to play .track files in editor and code?


photo

Recommended Posts

Hi,

I have created a .track file within the editor, but I can not figure out how to play this back within the game, either via code or in the editor?

It's a simple camera animations, it works fine from within the tracker tool, but as said I can't see how to play it within C# or auto-play when the game plays.

 

 

Link to comment

Hi Anthony!

The Tracker tool currently has got only UnigineScript API.

But it is possible to make a C# wrapper for it.

Suppose you have some .track files prepared, and you want to play them via C#...

This can be done as follows:

  1. Download the tracker_wrapper.h file attached.
  2. In the Asset Browser create a new USC script, let's call it script.usc
  3. In this file add the following line after all includes:
     #include <tracker_wrapper.h>
  4. Assign the script.usc file to your world by simply dragging it to the Script field in the Parameters window as shown below (when the .world-asset is selected in the Asset Browser)
    world_script.gif
  5. Now we need a C#-wrapper - simply download the attached TrackerWrapper.cs file and copy it to your project's source folder.
  6. Add the TrackerWrapper.cs file to your project. E.g., you can manually modify the .csproj file by adding the following line next to where all your AppEditorLogic, AppSystemLogic, and AppWorldLogic are included:   
    <Compile Include="source\TrackerWrapper.cs"/>
  7. Now we can simply play our tracks via C#. I've made a simple component for you to illustrate the process (please find the TrackPlayer.cs file attached).

    Assign this component to any node in the world (don't forget that the node should be enabled for the component's logic to be executed). Then drag your track(s) to the fields of the Tracks array (you can add as many as you wish). Then save your world, click Play, and enjoy your tracks playing in the game.

Hope this helps!

tracker_wrapper.h TrackerWrapper.cs TrackPlayer.cs

  • Like 2
  • Thanks 1
Link to comment
×
×
  • Create New...