This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Проигрывание треков в приложении

After the track-based animations were created in UnigineEditor, they need to be played in the application. To add this functionality to your project, add the following code to the world script:После того, как анимации на основе треков были созданы в UnigineEditor, их необходимо воспроизвести в приложении. Чтобы добавить эту функциональность в свой проект, добавьте в World Script следующий код:

Исходный код (UnigineScript)
#include <core/systems/tracker/tracker.h>

Unigine::Tracker::TrackerTrack track;
float time, min_time, max_time, unit_time;

int init() {

	// use the Tracker namespace
	using Unigine::Tracker;

	// create a Tracker instance that will play the tracks
	Tracker tracker = new Tracker();
	// load the required tracks from a file
	track = tracker.loadTrack("samples/tracker/tracks/render_00.track");
	
	// get the start time of the track (in units)
	min_time = track.getMinTime();
	// get the end time of the track (in units)
	max_time = track.getMaxTime();
	// get the duration of the track unit (in seconds)
	unit_time = track.getUnitTime();
	
	// set the initial time to play the tracks
	time = track.getMinTime();

	return 1;
}

int update() {
	
	if(track == NULL) return 1;
	
	// update the tracks animation time
	time += engine.game.getIFps() / unit_time;
	time = min_time + ((time - min_time)) % (max_time - min_time);
	
	// set animation time for tracks (time values outside the [mintime, maxtime] range are clamped automatically)
	if(engine.game.isEnabled()) track.set(time);
	
	return 1;
}
Примечание
Time values outside the [MinTime, MaxTime] range are clamped automatically.Значения времени за пределами диапазона [MinTime, MaxTime] автоматически обрезаются.
Последнее обновление: 06.04.2022
Build: ()