-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp_component_samples.sample
More file actions
3198 lines (3198 loc) · 208 KB
/
Copy pathcpp_component_samples.sample
File metadata and controls
3198 lines (3198 loc) · 208 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version='1.0' encoding='UTF-8'?>
<meta>
<samples_pack name="cpp_component_samples">
<title>C++ Samples</title>
<version>2.22</version>
<dependency>2.22</dependency>
<os>cross</os><workflow>editor2</workflow>
<precision>double</precision>
<path>data</path>
<command>world_load cpp_component_samples</command>
<custom_app>cpp_component_samples</custom_app>
<bin_type>development</bin_type>
<api>cmakecpp,vs2015cpp</api>
<plugins>FMOD,SpiderVision</plugins>
<git_repo>https://github.com/unigine-engine/cpp-api-samples/tree/release-2.22/source</git_repo>
<description>
<![CDATA[
<p>A set of samples showcasing the use of engine features for various use cases via the C++ API.</p>
]]>
</description>
<features>
<![CDATA[
<p><strong>Intersections</strong> samples different cases of intersection detection. The following samples are available:</p>
<ul>
<li><strong>Simple Async Request</strong> sample - demonstrating detection of intersections with all objects in the world using a combination of <em>World::getIntersection()</em> and <em>Landscape::getIntersection()</em> methods. A single ray from the mouse cursor position is used. A normal at the point of intersection is rendered and latency value is displayed.</li>
<li><strong>Multiple Async Requests</strong> sample - demonstrating detection of intersections with all objects in the world using a combination of <em>World::getIntersection()</em> and <em>Landscape::getIntersection()</em> methods. 900 rays from a moving emitter-objects are used. You can check out latency values (number of frames per each result).</li>
</ul>
<p><strong>Landscape Terrain</strong> samples demonstrating various Landscape Terrain features and use cases. The following samples are available:</p>
<ul>
<li><strong>Combined Landscape Modification</strong> sample - demonstrating combination of nondestructive (using multiple Landscape Layer Maps) and destructive (using <b>Landscape::asyncTextureDraw</b>) Landscape Terrain modification techniques.</li>
<li><strong>Landscape Creation</strong> sample - demonstrating dynamic creation of a Landscape Layer Map with albedo, height, and two mask textures using <b>LandscapeMapFileCreator</b> and <b>LandscapeMapFileSettings</b>.</li>
<li><strong>Details</strong> sample - demonstrating how to add Details to a Landscape Terrain using <b>ObjectLandscapeTerrain::getDetailMask</b> and <b>ObjectLandscapeTerrain::addDetail</b> methods.</li>
<li><strong>Fetch</strong> sample - demonstrating how to get terrain information (height, albedo, masks) for an arbitrary point.</li>
<li><strong>Landscape Mesh</strong> sample - demonstrating generation of a mesh (<b>ObjectMeshDynamic</b>) representing a certain region of the Landscape Terrain based on fetched Landscape data (<b>LandscapeFetch</b>).</li>
<li><strong>Paint</strong> sample - demonstrating destructive run-time Landscape Terrain modification by changing the underlying textures of the Landscape Layer Map using <b>Landscape::asyncTextureDraw</b> with the help of the custom base materials.</li>
<li><strong>Tracks</strong> sample - demonstrates non-destructive runtime Landscape Terrain modification by spawning multiple Landscape Layer Maps under the objects to create tracks.</li>
</ul>
<p><strong>Tracker</strong> sample demostrating how to use <b>Tracker</b> to animate objects (change their position, rotation, and scale) via tracks created in the <b>Tracker</b> tool. Tracks in code are referred to via names and IDs. A C++ wrapper for <b>Tracker</b> functionality is provided in the <b>Tracker</b> component.</p>
<p><strong>Water Global</strong> samples demostrating how to control Global Water via API. The following samples are available:</p>
<ul>
<li><strong>Buoyancy</strong> sample - demonstrating the control over the current state of the Global Water via changing Beaufort levels (the Beaufort slider). It also demonstrates the use of fetching of the water level at a certain point for simplified simulation of buoyancy without engaging Phyiscs.</li>
<li><strong>CustomWave</strong> sample - demonstrating how to control the wave spectrum of Global Water in Manual mode via API by changing the number of octaves, number of waves per octave, and various other parameters for random waves generation, such as wave length, amplitude, phase offset, and steepness (can be used, for example, to process Weather Control packets from IOS in a simulator application).</li>
<li><strong>Boat</strong> sample - demonstrating how to simulate ship wake foam via <b>Orthographic Decals</b> and <b>Particle Systems</b>, that are spawned behind the boat and project foam onto the water surface. You can control sea state via the Beaufort slider (from 0 - calm to 8 - huge waves).</li>
<li><strong>Fetch Intersection</strong> sample - demonstrating the influence of the <b>Steepness Quality, Amplitude Threshold</b>, and <b>Precision</b> parameters on the accuracy of fetch and intersection requests for the <b>Global Water</b> object at various Beaufort levels.</li>
</ul>
]]>
</features>
<products>
<product>tier3_bin_windows</product>
<product>tier3_bin_channel</product>
<product>tier3_bin_channel_windows</product>
<product>tier3_bin_channel_linux</product>
<product>tier3_src_windows</product>
<product>tier3_bin_linux</product>
<product>tier3_src_linux</product>
<product>tier3_evaluation</product>
<product>tier2_bin_windows</product>
<product>tier2_src_windows</product>
<product>tier2_bin_linux</product>
<product>tier2_src_linux</product>
<product>tier2_evaluation</product>
<product>tier0_bin</product>
<product>tier0_bin_pro</product>
<product>tier4_bin</product>
<product>tier4_evaluation</product>
</products>
<images>
<card_image>.meta/images/cpp_component_samples_rect.png</card_image>
<thumb>.meta/images/cpp_component_samples_sm.png</thumb>
<image>.meta/images/cpp_component_samples_001.png</image>
<image>.meta/images/cpp_component_samples_002.png</image>
<image>.meta/images/cpp_component_samples_003.png</image>
<image>.meta/images/cpp_component_samples_004.png</image>
<image>.meta/images/cpp_component_samples_005.png</image>
</images>
<copy_configuration>
<dir tag="external_resources">external_resources</dir>
</copy_configuration>
<categories>
<category id="scene_management" name="Scene Management" order="10" img="data/cpp_component_samples/scene_management/scene_management.png"/>
<category id="player_controllers" name="Player Controllers" order="20" img="data/cpp_component_samples/player_controllers/player_controllers.png"/>
<category id="input_handling" name="Input Handling" order="30" img="data/cpp_component_samples/input_handling/input_handling.png"/>
<category id="app_logic" name="App Logic" order="40" img="data/cpp_component_samples/app_logic/app_logic.png"/>
<category id="procedural_generation_placement" name="Procedural Generation & Placement" order="50" img="data/cpp_component_samples/procedural_generation_placement/procedural_generation_placement.png"/>
<category id="multi_threading_performance_optimization" name="Multithreading & Performance Optimization" order="60" img="data/cpp_component_samples/multi_threading_performance_optimization/multi_threading_performance_optimization.png"/>
<category id="simulation" name="Simulation" order="70" img="data/cpp_component_samples/simulation/simulation.png"/>
<category id="nodes" name="Nodes" order="80" img="data/cpp_component_samples/nodes/nodes.png"/>
<category id="terrain_modification_usage" name="Terrain Modification & Usage" order="90" img="data/cpp_component_samples/terrain_modification_usage/terrain_modification_usage.png"/>
<category id="physics" name="Physics" order="100" img="data/cpp_component_samples/physics/physics.png"/>
<category id="rendering" name="Rendering" order="110" img="data/cpp_component_samples/rendering/rendering.png"/>
<category id="animation_generic" name="Animation - Generic" order="120" img="data/cpp_component_samples/animation_generic/animation_generic.png"/>
<category id="animation_characters" name="Animation - Characters" order="130" img="data/cpp_component_samples/animation_characters/animation_characters.png"/>
<category id="navigation" name="Navigation" order="140" img="data/cpp_component_samples/navigation/navigation.png"/>
<category id="user_interface" name="User Interface" order="150" img="data/cpp_component_samples/user_interface/user_interface.png"/>
<category id="sounds" name="Sounds" order="160" img="data/cpp_component_samples/sounds/sounds.png"/>
<category id="network" name="Network" order="170" img="data/cpp_component_samples/network/network.png"/>
<category id="unigine_script_interop" name="UnigineScript Interop" order="180" img="data/cpp_component_samples/unigine_script_interop/unigine_script_interop.png"/>
</categories>
<samples>
<sample title="Bones: Constraints [Animation Graph]" order="1" id="bones_constraints" category_id="animation_characters">
<sdk_desc><![CDATA[Applying bone rotation constraints and observing how they affect inverse kinematics.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates the use of joint rotation limits in an <i>animation graph</i> and illustrates how they affect the operation of inverse kinematics.</p>
<p>The target of the chain is moved with a manipulator, and the <i>IK Chain</i> node bends the bones of the left leg towards it. The rotation of each joint is limited, so the chain can only bend the way a real joint would, instead of taking any pose that reaches the target.</p>
<p>Every joint has its own limit node, with the joint, the axes, and the angles set in its parameters. A <i>Joint Limit Set</i> node gathers them all into a single set that is applied to the chain.</p>
<p>Rotation constraints are useful for keeping automatically generated poses plausible, for example, to prevent an elbow or a knee from bending backwards.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Bones: Foot Placement [Animation Graph]" order="1" id="bones_foot_placement" category_id="animation_characters">
<sdk_desc><![CDATA[Adjusting the feet of a character to the height and the slope of an uneven surface using inverse kinematics and raycasting.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates a naive option for placing feet on a surface using inverse kinematics in an <i>animation graph</i>: a <i>Two Bone IK</i> node per leg bends them towards the points the feet have to reach, with the pelvis position adjusted so that both legs can reach the surface.</p>
<p>Raycasting is applied to detect surface contact: in each frame, a ray is cast downward through the foot position to find intersections with the surface. The resulting contact point and surface normal are then used to adjust the foot bones' position and orientation, ensuring realistic foot placement. Both the rays and the normals found at the contact points are visualized on the character.</p>
<p>Each leg blends into inverse kinematics only while its ray hits the surface, so a foot that steps off the platform returns to the animated pose smoothly instead of snapping.</p>
<p>The platform under the character can be moved with the manipulator switched on by the <i>T</i> key and rotated with the one switched on by the <i>R</i> key, so you can watch the feet adapt to the changing height and slope in real time.</p>
]]>
</brief>
</desc>
<controls>
<![CDATA[
<p>Key <b>T</b> - Platform movement manipulator.</p>
<p>Key <b>R</b> - Platform rotation manipulator.</p>
]]>
</controls>
<tags>
<tag>Animation</tag>
<tag>Intersections</tag>
</tags>
</sample>
<sample title="Bones: Inverse Kinematics [Animation Graph]" order="1" id="bones_inverse_kinematics" category_id="animation_characters">
<sdk_desc><![CDATA[Controlling bones with inverse kinematics.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to control bones using inverse kinematics in an <i>animation graph</i>. Instead of rotating each bone individually, the <i>Two Bone IK</i> node takes the position the end of the chain has to reach and bends the bones towards it. Here the chain is the left leg of the character, with its three joints picked in the node's parameters.</p>
<p>The node takes the pose from the <i>Animation Player</i> node, solves the chain against the target, and passes the result on, so the idle keeps playing while the foot reaches for it. The lower manipulator moves that target, the upper one moves the pole vector that defines the plane the chain bends in.</p>
<p>The example is useful for creating animations where character bones are automatically positioned and oriented to achieve realistic movement.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Bones: Look At Chains [Animation Graph]" order="1" id="bones_look_at_chains" category_id="animation_characters">
<sdk_desc><![CDATA[Using LookAt chains to aim the bones of a character at a target.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates the use of LookAt chains for aiming at a target in an <i>animation graph</i>: the <i>Look At Chain</i> node turns the bones of the chain automatically so that the character follows the target with its body.</p>
<p>The chain contains three spine bones, the neck, and the head. Each of them has its own weight defining how much it contributes to the resulting rotation - the weights grow towards the head, so the head turns the most and the body follows more subtly.</p>
<p>One manipulator moves the target the character looks at, the other one moves the pole vector that sets the upward direction for the bones of the chain.</p>
<p>The bones, their weights, and their axes are set in the parameters of the <i>Look At Chain</i> node.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Bones: Retargeting [Animation Graph]" order="1" id="bones_retargeting" category_id="animation_characters">
<sdk_desc><![CDATA[Using the same animation on skeletons with different proportions.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how the same animation can be used on skeletons with different proportions.</p>
<p>Both pairs play the same walking animation through an <i>animation graph</i>. The pair on the left plays it as is, so the child inherits the proportions of the adult and appears stretched. The pair on the right plays the retargeted version, where the child keeps its own proportions.</p>
<p>Retargeting works automatically as long as the skeleton is shared between the skinned mesh and the animation. To prevent stretching when the proportions differ, rotation-only masks are applied to most of the bones, while the hip and the ground-contact bones receive full transformations to keep the body height and the placement on the ground correct.</p>
<p>Retargeting is useful when you need to use the same animation source for different characters or objects with varying proportions but similar skeletal structures. This approach significantly speeds up the process of preparing animations.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Bones: Root Motion [Animation Graph]" order="1" id="bones_root_motion" category_id="animation_characters">
<sdk_desc><![CDATA[Moving an object by the offset of the root bone of its animation.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates the implementation of the <b>root motion</b> technique, where the movement stored in the root bone of an animation is applied to the object itself instead of being played in place.</p>
<p>Both characters play the same walking animation through an <i>animation graph</i>, and the only difference between the two graphs is the <b>Root Motion</b> option. The character on the left keeps walking in place, while the one on the right is carried along the path of the animation. The coordinate axes drawn at the position of each character show the difference.</p>
<p>The movement accumulated by the animation is read every frame as a delta transformation and applied to the world transformation of the node after the animation has been evaluated.</p>
<p>Root motion is particularly valuable for realistic character, vehicle, or object movements in games and simulations, as the object goes exactly where the animation takes it, with no foot skating.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Bones: State Machine [Animation Graph]" order="1" id="bones_state_machine" category_id="animation_characters">
<sdk_desc><![CDATA[Controlling character animation with state machines and blend spaces built in an animation graph.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to build animation state machines in an <i>animation graph</i>. A state machine manages various object states - such as idle, walking, or running - and handles transitions between them.</p>
<br/>
<p>Three characters show different configurations, each with its own graph:</p>
<p> - <b>Walk</b> (left) - transitions between idle and walking depending on the speed value, with a separate turn-around animation triggered by a flag.</p>
<p> - <b>Turn</b> (center) - a one-dimensional <i>blend space</i>, where a single value between -1 and 1 blends between turning left, standing still, and turning right.</p>
<p> - <b>Run</b> (right) - a two-dimensional blend space, where one value blends idle, walking, and running, and the other one blends turning to the left and to the right.</p>
<p>The component itself only sets the named parameters of each graph from the keyboard input, while all the states, transitions, and blending are configured in the graph assets. Every state machine also uses root motion, so the characters are carried by the animations they play.</p>
<p>Implementing state machines enables the creation of complex, flexible character behaviors.</p>
]]>
</brief>
</desc>
<controls>
<![CDATA[
<p>Walk State Machine (left):</p>
<p> Key <b>T</b> - set maximum speed.</p>
<p> Key <b>G</b> - set minimum speed.</p>
<p> Key <b>Y</b> - turn around.</p>
<p> </p>
<p>Idle Turn State Machine (center):</p>
<p> Key <b>V</b> - increase turn left.</p>
<p> Key <b>C</b> - increase turn right.</p>
<p> </p>
<p>Walk Run State Machine (right):</p>
<p> Key <b>I</b> - increase y.</p>
<p> Key <b>K</b> - decrease y.</p>
<p> Key <b>L</b> - increase x.</p>
<p> Key <b>J</b> - decrease x.</p>
]]>
</controls>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Bones: Masks" id="bones_masks" category_id="animation_characters">
<sdk_desc><![CDATA[Using masks to assign selective logic to different bones.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to use bone masks to selectively apply animation data.</p>
<p>Masks enable complex animation combinations. For example, you can preserve the original body movements while limiting head or arm animations to rotation, or scaling specific bones.</p>
<p>In this example, the right (child) model has a component that lists bones using a rotation-only mask from the left (adult) model's animation. The scale is masked out, so the listed bones keep their original size. If the mask is not applied, the bones appear stretched, as all transformations (including scale) are copied from the adult model. This can be seen on the child model's arms, where the mask is not used.</p>
<p>Masking is enabled per animation layer, and every bone listed in the properties of the sample component is then set to take the rotation from the animation only, leaving its own position and scale intact.</p>
<p>This method is excellent for multi-layered animations, allowing you to mix motions, add effects, or exclude certain parts of the model to achieve specific visual results or behaviors without duplicating full animation sets.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Bones: Sandbox" id="bones_sandbox" category_id="animation_characters">
<sdk_desc><![CDATA[An interactive sandbox for setting up IK chains, LookAt chains, and bone rotation constraints at runtime.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample provides the interface that allows visualizing and experiencing how to configure all available settings for IK chains, LookAt chains, and bone rotation constraints.</p>
<p>The skeleton of the character is displayed as a tree, where you can pick the bone to work with and see it highlighted in the viewport. Three editors are available for it:</p>
<p> - <b>IK</b> - creating chains and adjusting the target and pole positions, the rotation of the effector, the number of solver iterations, the tolerance, and the constraint modes.</p>
<p> - <b>LookAt</b> - creating chains, adding bones to them, setting the target and pole positions, and adjusting the weight and the axes of each bone.</p>
<p> - <b>Constraints</b> - setting the minimum and maximum angles of rotation around the yaw, pitch, and roll axes for a certain bone.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Bones: Rotation [Animation Graph]" order="1" id="bones_rotation" category_id="animation_generic">
<sdk_desc><![CDATA[Blending skeletal animations in an animation graph and rotating a bone programmatically.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to combine skeletal animation playback with direct modification of bone transforms.</p>
<p>The turret plays an idle animation, over which the left and right shooting animations are blended additively by a state machine in the <i>animation graph</i>.</p>
<p>On top of that, the horizontal joint of the turret is rotated from code at a constant speed. The rotation is applied after the animation graph has written its pose, so that the played animation does not overwrite it.</p>
<p>Combining played animations with programmatic bone control is useful for turrets and other cases where part of a skeleton has to be driven by code rather than by a pre-made animation.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Animation Layers Playback" id="animation_layers_playback" category_id="animation_generic">
<sdk_desc><![CDATA[Demonstration of animation sequences played in order or simultaneously.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates composing a single animation out of several reusable sequences using <i>AnimationChannelSubSequence</i> - a channel that holds other sequences as clips, with each clip having its own start time and duration.</p>
<br/>
<p>Three single-parameter sequences are created first: a Z position bounce, a rotation around the Z axis, and a scale pulse. They are then combined in two different ways, and both results are played at the same time:</p>
<p> - The <b>left box</b> plays the clips starting at the same time, so its position, rotation, and scale are animated simultaneously.</p>
<p> - The <b>right box</b> plays the clips one after another. A clip that has finished stops writing its parameter, and the box keeps the value it was left with.</p>
<p>Both players use the same three sequences. Instead of duplicating them for each box, every player enumerates the binds of its sequences, including the ones inside the clips, and points them at its own box, so the sequences remain reusable and are not changed themselves.</p>
<p>Composing animations out of reusable pieces makes it possible to build complex animation scenarios from a small set of simple sequences and reuse them for any number of objects.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Curve2D Animation" id="curve2d_animation" category_id="animation_generic">
<sdk_desc><![CDATA[Real-time animation of transformations and material parameters using <i>Curve2D</i> for flexible, non-linear motion.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates animating node transformations and material parameters with <i>Curve2D</i> values sampled every frame.</p>
<br/>
<p>Two components are shown:</p>
<p> - <b>CurveAnimationTransform</b> - animates the transformation of a node. Position, rotation, and scale have a separate curve for each of the <b>X, Y, Z</b> axes, so every axis can be shaped independently. The curves are evaluated at the current time and composed into the final transformation matrix. In the sample it moves the platforms, and changes the coins and heart transformations.</p>
<p> - <b>CurveAnimationMaterialParamFloat</b> - animates float parameters of a material. Each entry of the list binds a curve to a parameter by its name and surface index, so any number of parameters can be animated at once. In the sample it pulses the emission of the coins and the heart.</p>
<p>The curves and the playback speed are available in the properties of the corresponding component in UnigineEditor, where the curves can also be shaped in the <i>Curve Editor</i>.</p>
<p>This setup is useful for looping motions and dynamic material effects that do not require external animation assets.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
<tag>Basic Recipes</tag>
<tag>Transformations</tag>
</tags>
</sample>
<sample title="Global Engine Parameters Animation" id="global_engine_parameters_animation" category_id="animation_generic">
<sdk_desc><![CDATA[Animating global Engine parameters, such as physics gravity and render background color, using <i>singleton channels</i>.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates animating global Engine parameters using <b>singleton channels</b> - animation channels that have no bind and target a global system instead of a certain node, material, or property.</p>
<p>Two parameters are animated at the same time by a single <i>AnimationSequence</i>: the Z component of physics gravity and the alpha component of the render background color. Their current values are displayed in the <i>State</i> window.</p>
<p>The sequence is saved to a <b>.seq</b> file in the <b>sequences</b> folder of the world and then played back right from this file, demonstrating a serialization roundtrip. If the file is unavailable, the sequence stored in memory is played instead.</p>
<p>Animating global parameters gives you programmatic control over scene effects, weather changes, time transitions, and physical properties, resulting in more engaging and interactive scenes.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
<tag>Basic Recipes</tag>
</tags>
</sample>
<sample title="Material Parameters Animation" id="material_parameters_animation" category_id="animation_generic">
<sdk_desc><![CDATA[Changing material parameters at runtime.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample illustrates how to change the parameters of <i>materials</i> at runtime. Each object in the scene has its own component that animates one of the parameters continuously:</p>
<p> - <b>Albedo color</b> - smoothly transitions between two colors.</p>
<p> - <b>Albedo texture</b> - alternates between two textures loaded from files.</p>
<p> - <b>Metalness</b> - smoothly transitions between two values.</p>
<p> - <b>Emission</b> state - is switched on and off, making the object blink.</p>
<p> - <b>Cast World Shadow</b> state - is switched on and off, making the shadow of the object appear and disappear.</p>
<p>The parameters can be edited in the properties of the corresponding components in UnigineEditor. The current value of every animated parameter is displayed in the <i>State</i> window.</p>
<p>Changing material parameters at runtime is the basis for various dynamic effects, such as highlighting the objects the user interacts with, indicating the state of a device, or reproducing the changes of a surface over time.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
<tag>Materials</tag>
</tags>
</sample>
<sample title="Node Parameters Animation" id="node_parameters_animation" category_id="animation_generic">
<sdk_desc><![CDATA[Animating position, rotation, and scale of a node using <i>node binds</i> and different types of animation channels.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates animating the transformation of a node using <b>node binds</b> - <i>AnimationBindNode</i> objects that point animation channels at a certain node, identified by its ID and name.</p>
<p>A box is animated by three channels of different types added to a single <i>AnimationSequence</i>, all of them sharing the same bind:</p>
<p> - <i>AnimationChannelScalar</i> - animates a single float value, here the Z position of the box.</p>
<p> - <i>AnimationChannelQuat</i> - animates rotation via quaternion interpolation. Along with the quaternion mode used here, the rotation can also be composed of three separate curves for each of the angles.</p>
<p> - <i>AnimationChannelFVec3</i> - animates a three-component vector, here the scale of the box.</p>
<p>The position channel gets its keyframes from an <i>AnimationCurveScalar</i> curve created explicitly, while the other two channels take the values directly. The keys use smooth interpolation based on a Bezier curve, so the box moves and resizes with easing instead of linearly.</p>
<p>The current values of the animated parameters are displayed in the <i>State</i> window.</p>
<p>Node animations can serve as a foundation for various effects, including element appearance/disappearance, rotations, resizing, and more.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Physics-Based Animation" id="physics_based_animation" category_id="animation_generic">
<sdk_desc><![CDATA[Physics-based animation of movements using easing functions and spring simulation.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates several ways of moving an object towards a target smoothly, shown as a simple game.</p>
<p>The sample has two modes, switched with the buttons in the description window.</p>
<p>In the <b>Animations Demo</b> mode, the way of moving is selected from the drop-down list, with each of them implemented as a separate component:</p>
<p> - <b>Linear</b> - moves at a constant speed.</p>
<p> - <b>EaseIn</b> - accelerates gradually.</p>
<p> - <b>EaseInOut</b> - accelerates at the start and decelerates at the end.</p>
<p> - <b>EaseOut</b> - decelerates gradually.</p>
<p> - <b>EaseOutElastic</b> - oscillates around the destination before settling on it.</p>
<p> - <b>EaseOutBack</b> - overshoots the destination slightly and comes back to it.</p>
<p> - <b>EaseOutBounce</b> - bounces at the destination.</p>
<p>In the <b>Start Game</b> mode, you control the laser pointer with the mouse, and the cat chases it using spring simulation, becoming faster and more responsive over time until it catches the pointer.</p>
<p>The parameters of each way of moving are available in the properties of the corresponding component in UnigineEditor.</p>
<p>Easing and spring-based motion make the movement of objects look natural, which is useful for cameras, UI elements, followers, and any object that has to reach a moving target smoothly.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Property Animation" id="property_animation" category_id="animation_generic">
<sdk_desc><![CDATA[Animating a parameter of a property assigned to a node and using the animated value to drive the logic of the sample.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates animating property parameters using <i>AnimationBindPropertyParameter</i>, which points an animation channel at a certain parameter of a property assigned to a node.</p>
<p>A box has the <b>speed_prop</b> property assigned to it, with a single float parameter named <b>speed</b>. This parameter is animated by an <i>AnimationChannelFloat</i> channel: the value grows from <b>0</b> to <b>120</b>, then goes down to <b>-120</b>, and returns back to <b>0</b>.</p>
<p>The animation itself does not move the box. Each frame the sample reads the current value of the <b>speed</b> parameter and rotates the box at this speed. The current value is displayed in the <i>State</i> window.</p>
<p>This pattern is useful for data-driven animations, where the animation system controls the values, and the logic decides how to use them. The same animated parameter can be read by any number of components, and the property can be reassigned to another node without changing the animation.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
<tag>Properties</tag>
</tags>
</sample>
<sample title="Tracker: Playback" id="tracker_playback" category_id="animation_generic">
<sdk_desc><![CDATA[Using <i>Tracker</i> to animate the position, rotation, and scale of an object.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates playing back animation tracks created in the <b>Tracker</b> tool and stored in <b>.track</b> files.</p>
<p>Three tracks are played at the same time, animating the position, rotation, and scale of the object independently. The position and rotation tracks are listed in the properties of the <b>Tracker</b> component and loaded on its initialization, while the scale track is added later by the <b>TrackPlayback</b> component.</p>
<p>The tracks are addressed in two different ways: by their ID, cached once at initialization, and by their name, which is more readable but requires a lookup on every call.</p>
<p>Each track keeps its own playback time, advanced every frame and wrapped back to the beginning at the end of the track.</p>
<p>Tracker comes in handy for creating complex animation scenarios, where the animation is authored visually rather than in code.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
</tags>
</sample>
<sample title="Widget Animation" id="widget_animation" category_id="animation_generic">
<sdk_desc><![CDATA[Animating widget position, font size, and color using runtime binds.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates animating widgets using <i>AnimationBindRuntime</i>, a bind that stores the runtime instance of a target object. It can point an animation channel at any Engine object, such as a widget, a body, or a camera.</p>
<p>A looped title animation is played on three labels: the <b>Player 0</b> and <b>Player 1</b> labels are animated by position, font color, and font size, while the <b>vs</b> label between them is animated by font color only.</p>
<p>A channel animates a single parameter, so a label animated by several parameters at once needs a separate channel for each of them, with the same bind assigned to all of them.</p>
<p>Animating interface elements programmatically helps create more lively, appealing user interfaces and enables automation of their behavior.</p>
]]>
</brief>
</desc>
<tags>
<tag>Animation</tag>
<tag>Interface (GUI)</tag>
<tag>Widgets</tag>
</tags>
</sample>
<sample title="Advanced Event Connection Patterns" id="advanced_event_connection_patterns" category_id="app_logic">
<sdk_desc><![CDATA[Advanced ways of subscribing to events in UNIGINE: using extra arguments, discarding parameters, and storing connection handles for disconnection.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates advanced usage of the UNIGINE <b>event system</b>.</p>
<p><i>EventsAdvancedSample.cpp</i> triggers custom rotation events when specific keys are pressed. Each event passes one or more arguments to connected listeners.</p>
<p><i>EventsAdvancedUnit.cpp</i> shows how to connect various types of handlers, including:</p>
<p> - Class methods with extra arguments</p>
<p> - Free functions with discarded or additional arguments</p>
<p> - Lambdas using <i>connectUnsafe()</i></p>
<p> - Storing connections using <i>EventConnection</i> or <i>EventConnectionId</i> for later disconnection</p>
<p>This sample helps understand flexible patterns for event handling in modular component systems.</p>
]]>
</brief>
</desc>
<controls>
<![CDATA[
<p><b>T</b> — Rotate around X-axis</p>
<p><b>Y</b> — Rotate around Y-axis</p>
<p><b>U</b> — Rotate around Z-axis</p>
<p><b>I</b> — Rotate around all axes (XYZ)</p>
]]>
</controls>
<tags>
<tag>Systems</tag>
<tag>Logic</tag>
<tag>Events</tag>
<tag>Input & Controls</tag>
</tags>
<keywords>Input,Keyboard,Subscription</keywords>
</sample>
<sample title="Component Parameters In Editor" id="component_parameters_in_editor" category_id="app_logic">
<sdk_desc><![CDATA[Demonstration of component parameter types and configuration options.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates possible variations of component parameter types available in the <b>Component System</b>. It includes primitive types, vectors, masks, files, properties, materials, nodes, curves, structs, arrays, and advanced features like conditional visibility and value filtering.</p>
<p>Select the <b>component_parameters</b> <i>Node Dummy</i> in the Editor and explore all parameter variations in the <i>Parameters</i> window. This serves as a comprehensive reference for available parameter types and their configuration options.</p>
]]>
</brief>
</desc>
<tags>
<tag>Component System</tag>
<tag>Programming</tag>
<tag>Logic</tag>
</tags>
</sample>
<sample title="Component System Example" id="component_system_example" category_id="app_logic">
<sdk_desc><![CDATA[Demonstration of UNIGINE's C++ component-based architecture using custom gameplay components with dynamic object creation and interaction.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample illustrates how to implement your application's logic via a set of building blocks - <b>components</b>, and assign these blocks to nodes. A logic component integrates a node, a property, and a C++ class containing logic implementation.</p>
<p>The sample includes a controllable pawn with basic movement, rotating boxes that periodically spawn projectiles, and a floating UI label displaying health, survival time, and active component count.</p>
<p>The sample demonstrates how to:</p>
<p> - Decompose application logic into modular, reusable components</p>
<p> - Create and assign custom logic components at runtime</p>
<p> - Implement interaction between independently managed components.</p>
<p>More details about the Component System sample are available in the official documentation linked below.</p>
]]>
</brief>
</desc>
<link_docs>https://developer.unigine.com/docs/code/usage/using_component_system/index?rlang=cpp</link_docs>
<controls>
<![CDATA[<p align=left>Keys <b>UP / W</b> and <b>DOWN / S</b> to move forward/backward</p>
<p align=left>Keys <b>LEFT / A</b> and <b>RIGHT / D</b> for clockwise/counterclockwise rotation</p>
]]>
</controls>
<tags>
<tag>Logic</tag>
<tag>Basic Recipes</tag>
<tag>Component System</tag>
</tags>
<keywords>Architecture,Game</keywords>
</sample>
<sample title="Console Interaction" id="console_interaction" category_id="app_logic">
<sdk_desc><![CDATA[Interacting with the Engine's built-in console and adding custom console commands and variables via API using the <i>Console</i> and <i>ConsoleVariable</i> classes.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to interact with the Engine's built-in console and add custom console commands and variables via API using the <i>Console</i> and <i>ConsoleVariable</i> classes. It shows how to define different types of console variables: <i>ConsoleVariableInt</i>, <i>ConsoleVariableFloat</i>, and <i>ConsoleVariableString</i>, and how to register custom console commands.</p>
<p>Commands are linked to callback functions using <i>MakeCallback</i>, and can be executed directly from code or entered manually through the console. Commands can also be added and removed dynamically at runtime, making the system flexible for various use cases. Console variables can be accessed or changed through both code and the console interface.</p>
<p>For demonstration, to move the Material Ball in the scene use the custom command <b>control_node [x] [y] [z]</b> in the Console (`), where <i>x, y, z</i> are the target world coordinates (e.g., <b>control_node 0 5 1</b>).</p>
<p>This functionality can be used for development, debugging, rapid prototyping, and runtime adjustments in interactive applications.</p>
]]>
</brief>
</desc>
<tags>
<tag>Systems</tag>
<tag>Logic</tag>
</tags>
</sample>
<sample title="Custom Stream" id="custom_stream" category_id="app_logic">
<sdk_desc><![CDATA[Creating a custom stream class by inheriting from <i>StreamBase</i> and using it for reading from and writing to files.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to create a custom stream class by inheriting from <i>StreamBase</i> and use it for reading from and writing to files. The resulting stream is used to serialize and deserialize basic data types to and from a binary file.</p>
<p>The sample provides a wrapper around standard <i>C</i> file <i>I/O</i> functions and integrates with the <b>UNIGINE</b> stream system by implementing the <i>StreamBase</i> interface. In the sample logic, a binary file is first created and filled with data via <i>Stream::writeString()</i>, <i>writeInt()</i>, and <i>writeFloat()</i>. Then the file is reopened in read mode and the same values are read back using the corresponding <i>Stream 'read'</i> methods, verifying the functionality of the custom stream.</p>
<p>This example serves as a reference for implementing custom stream sources (e.g., from memory, network, or virtual filesystems) and integrating them with the Engine's serialization tools.</p>
]]>
</brief>
</desc>
<tags>
<tag>Logic</tag>
</tags>
</sample>
<sample title="Euler Angle Composition And Decomposition" id="euler_angle_composition_and_decomposition" category_id="app_logic">
<sdk_desc><![CDATA[Composing and decomposing object rotation using Euler angles in different axis sequences.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how the order in which Euler angles are applied changes the resulting rotation. The same three angles applied as <i>XYZ, XZY, YXZ, YZX, ZXY</i>, or <i>ZYX</i> produce six different orientations.</p>
<p>The sample also does the opposite: it takes the current rotation of the object and converts it back into <b>Pitch, Roll</b>, and <b>Yaw</b> angles for the selected sequence, displaying them as you rotate the object. These angles may differ from the ones used to set the rotation because of gimbal lock.</p>
]]>
</brief>
</desc>
<tags>
<tag>Basic Recipes</tag>
<tag>Transformations</tag>
</tags>
<keywords>Math</keywords>
</sample>
<sample title="Event Connection Patterns" id="event_connection_patterns" category_id="app_logic">
<sdk_desc><![CDATA[Demonstration of four different patterns of subscribing to UNIGINE's <i>Events</i> via the C++ API, highlighting how event handler lifetime and management can vary depending on the approach.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates four different patterns for subscribing UNIGINE's <i>Events</i> via the C++ API, highlighting how event handler lifetime and management can vary depending on the approach.</p>
<p>Each method demonstrates a different strategy for connecting to the same event and managing event handler lifetimes:</p>
<p> - <i>EventConnectionExample</i> stores a single event handler with manual control over its activation. This type of connection is useful when you need precise control — you can enable, disable, or fully disconnect the handler at any time.</p>
<p> - <i>EventConnectionsExample</i> acts as a container for multiple handlers. It handles cleanup automatically (via the destructor) and manually (by calling <i>EventConnections::disconnectAll()</i>). This is useful when you have many event handlers with varying lifetimes that need to be grouped.</p>
<p> - <i>InheritedEventConnectionExample</i> inherits <i>EventConnections</i> class, making connection management part of its internal logic. All connected handlers are automatically disconnected when the object is destroyed.</p>
<p> - <i>CallbackIDConnection</i> provides a low-level, manual way to manage handlers using a connection ID. It offers flexibility but requires careful memory and lifetime handling. This approach is considered unsafe and should only be used when you fully understand the implications.</p>
<p>Each example connects to a shared <i>EventHolder</i>, and handlers are triggered with a sample value. This setup is useful when designing modular, reactive systems that rely on flexible and explicit event-driven logic.</p>
]]>
</brief>
</desc>
<tags>
<tag>Systems</tag>
<tag>Logic</tag>
<tag>Events</tag>
</tags>
<keywords>Subscription</keywords>
</sample>
<sample title="File System External Package" id="filesystem_external_package" category_id="app_logic">
<sdk_desc><![CDATA[Demonstration of working with external package files via the <i>Package</i> class.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to create a custom data package using code and use it to generate objects in the scene. It creates a box mesh and spawns it 64 times in the scene with varied positions and rotations.</p>
<p>Package is a collection of files and data for UNIGINE projects stored in a single file. The <i>Package</i> class is a data provider for the File System. You can use it to load all necessary resources. Packages can be used to conveniently transfer files between your projects or exchange data with other users, be it content (a single model or a scene with a set of objects driven by logic implemented via C++ components) or files (plugins, libraries, execution files, etc.).</p>
]]>
</brief>
</desc>
<tags>
<tag>Systems</tag>
<tag>Logic</tag>
<tag>File System</tag>
</tags>
</sample>
<sample title="File System Mount Points" id="filesystem_mount_points" category_id="app_logic">
<sdk_desc><![CDATA[Creating and using mount points in the file system for accessing external folders and package files (e.g., <b>*.zip</b>, <b>*.ung</b>).]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates the functionality of mount points in the Engine file system.</p>
<p><i>MountPointsSample.cpp</i> allows you to add or remove mount points for a folder and a package archive via API. If the mount point is active, an image stored inside will be loaded and displayed.</p>
<p>Mounted paths are shown in the <i>UI</i> window, where you can toggle between mounting or unmounting each resource. Images are accessed using virtual paths defined by the mount location.</p>
<p>The sample illustrates the concept of virtualized file access: if a resource is not available via a mount point, it will not be found or displayed by the Engine.</p>
<p>This approach is useful for working with external content (stored outside the <b>data</b> folder), modular data loading, or switching asset sets at runtime.</p>
]]>
</brief>
</desc>
<tags>
<tag>File System</tag>
</tags>
</sample>
<sample title="File Operations" id="file_operations" category_id="app_logic">
<sdk_desc><![CDATA[Demonstration of basic file I/O operations.]]></sdk_desc>
<desc>
<brief>
<![CDATA[This sample shows how you can create a text file and display its contents inside the widget via C++ API by using the <i>File</i> class. To create a text file, type the text from keyboard inside the <i>Writer</i> widget and press <b>Write</b> to save. Click <b>Read</b> inside the <i>Reader</i> widget to display the recorded information. The saved information will be displayed in the same widgets when you start the sample next time.]]>
</brief>
</desc>
<tags>
<tag>File System</tag>
</tags>
</sample>
<sample title="Inverse FPS Usage" id="inverse_fps_usage" category_id="app_logic">
<sdk_desc><![CDATA[Using <i>Game::getIFps()</i> to implement movement logic independent of the frame rate.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates the importance of using <i>Game::getIFps()</i> to implement movement logic independent of the frame rate.</p>
<p>Two cubes move back and forth along the X-axis. Use the <i>Max render fps</i> slider to change the frame rate of the application and compare their behavior.</p>
<p>The green cube uses <i>Game::getIFps()</i> to scale its movement by the frame time delta, which keeps its speed consistent across varying frame rates.</p>
<p>The red cube does not use <i>Game::getIFps()</i> and simply applies constant translation per frame, so its speed changes together with the frame rate.</p>
]]>
</brief>
</desc>
<tags>
<tag>Logic</tag>
</tags>
<keywords>iFPS,deltaTime</keywords>
</sample>
<sample title="JSON" id="json" category_id="app_logic">
<sdk_desc><![CDATA[Generation of a structured <i>JSON</i> document containing objects, arrays, and various data types such as strings, numbers, booleans, and null values, followed by traversal and pretty-printed output.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample shows how to generate a structured <i>JSON</i> document containing objects, arrays, and various data types such as strings, numbers, booleans, and null values. It also demonstrates how to traverse and print this structure recursively with indentation, imitating a pretty-printed output.</p>
<p>The sample begins by constructing a custom <i>JSON</i> structure in memory using <i>Json::create()</i> and its child manipulation methods. Nodes are added dynamically and include both named and unnamed children of various types. Once built, the structure is traversed recursively and printed to the Console in a readable format using indentation and commas, based on node type and position. The code demonstrates how to distinguish between arrays, objects, and primitive values when printing.</p>
<p>This sample is useful for learning the basics of <i>JSON</i> manipulation, such as creating structured data, traversing an element tree, and formatting output. It can serve as a foundation for processing <i>JSON</i> data (e.g., responses to <i>REST API</i> requests), as well as for complex serialization or debugging tools.</p>
]]>
</brief>
</desc>
<tags>
<tag>File Formats</tag>
</tags>
<keywords>Parser</keywords>
</sample>
<sample title="Materials And Properties Enumeration" id="materials_and_properties_enumeration" category_id="app_logic">
<sdk_desc><![CDATA[Working with <i>Property Manager</i> and <i>Material Manager</i> to access all materials and properties in the project via API.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to access all materials and properties in the project via API.</p>
<p>The sample iterates through the list of registered in the <i>Property Manager</i> via <i>Properties::getProperty()</i> and prints out the names and child counts for each. It also gets all available materials from the <i>Materials Manager</i> via <i>Materials::getMaterial()</i>, and lists them along with their file paths and number of children.</p>
<p>This can be used as a reference for accessing and working with project assets at runtime - whether for inspection, dynamic assignment, or content management logic.</p>
]]>
</brief>
</desc>
<tags>
<tag>Materials</tag>
<tag>Properties</tag>
</tags>
</sample>
<sample title="Type Safe Callbacks" id="type_safe_callbacks" category_id="app_logic">
<sdk_desc><![CDATA[Using the <i>CallbackBase</i> class to wrap and call functions and class methods with various numbers of arguments.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to use the <i>CallbackBase</i> class via the C++ API to wrap and call functions and class methods with various numbers of arguments.</p>
<p>Callback mechanism is useful in scenarios such as event-driven systems, user interface interactions, or asynchronous task management in applications requiring dynamic function invocation.</p>
<p>Open the Console (`) to view the callback execution log.</p>
]]>
</brief>
</desc>
<tags>
<tag>Systems</tag>
<tag>Logic</tag>
</tags>
</sample>
<sample title="XML" id="xml" category_id="app_logic">
<sdk_desc><![CDATA[Creating and manipulating an <i>XML</i> document using the <i>Xml</i> class.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to create and manipulate an <i>XML</i> document using the <i>Xml</i> class. It creates a nested <i>XML</i> tree with multiple child nodes, each containing arguments and optionally a text value.</p>
<p>The structure is built using the <i>Xml::addChild()</i> method, and the arguments are parsed using <i>Xml::getArgName()</i> and <i>Xml::getArgValue()</i>. After construction, the <i>XML</i> tree is traversed recursively to display the structure and all attributes in the Console output.</p>
<p>This approach demonstrates the use of the <i>Xml</i> class for working with hierarchical data, which is useful for config files, level data, and other structured content in <i>XML</i> format.</p>
]]>
</brief>
</desc>
<tags>
<tag>File Formats</tag>
</tags>
<keywords>Parser</keywords>
</sample>
<sample title="Gamepad" id="gamepad" category_id="input_handling">
<sdk_desc>
<![CDATA[This sample demostrates the simple usage of Gamepad input.]]>
</sdk_desc>
<desc>
<brief>
<![CDATA[This sample demostrates the simple usage of Gamepad input.]]>
</brief>
</desc>
<tags>
<tag>Input & Controls</tag>
</tags>
</sample>
<sample title="Joystick" id="joystick" category_id="input_handling">
<sdk_desc><![CDATA[This sample demonstrates how to add advanced joystick input handling, supporting multiple controllers with real-time axis/button monitoring and force feedback effects.]]></sdk_desc>
<desc>
<brief>
<![CDATA[This sample demonstrates how to add advanced <b>joystick</b> input handling, supporting multiple controllers with real-time axis/button monitoring and force feedback effects in UNIGINE. It features dynamic UI for testing 10+ force feedback types (springs, vibrations, waves) and automatically handles device connection/disconnection events. Ideal for racing/flight simulators or any project requiring precise controller input with haptic feedback.]]>
</brief>
</desc>
<tags>
<tag>Input & Controls</tag>
</tags>
</sample>
<sample title="Keyboard And Mouse" id="keyboard_and_mouse" category_id="input_handling">
<sdk_desc><![CDATA[This sample demonstrates how to add monitoring of keyboard and mouse input, tracking key states, mouse movements, wheel events, and cursor positions across different coordinate systems. It displays real-time input data including key presses, mouse deltas, and text input.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to add monitoring of keyboard and mouse input, tracking key states, mouse movements, wheel events, and cursor positions across different coordinate systems. It displays real-time input data including key presses, mouse deltas, and text input. The sample shows three mouse handling modes:</p>
<p> - <b>GRAB</b> - locks and hides the cursor</p>
<p> - <b>SOFT</b> - locks the cursor to the window but keeps it visible</p>
<p> - <b>USER</b> - no cursor restrictions.</p>
]]>
</brief>
</desc>
<tags>
<tag>Input & Controls</tag>
</tags>
</sample>
<sample title="Touch" id="touch" category_id="input_handling">
<sdk_desc>
<![CDATA[This sample demonstrates how to add multi-touch input from the <b>touchscreen</b>, visualizing finger positions with dynamic circles and displaying real-time coordinates to the project.]]>
</sdk_desc>
<desc>
<brief>
<![CDATA[This sample demonstrates how to add multi-touch input from the <b>touchscreen</b>, visualizing finger positions with dynamic circles and displaying real-time coordinates to the project.]]>
</brief>
</desc>
<tags>
<tag>Input & Controls</tag>
</tags>
<keywords>Touchscreen</keywords>
</sample>
<sample title="Asynchronous Meshes And Textures Loading" id="asynchronous_meshes_and_textures_loading" category_id="multi_threading_performance_optimization">
<sdk_desc><![CDATA[Loading meshes and textures in a separate thread using the <i>AsyncQueue</i> class.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample shows how to load resources like meshes and textures in the background using the <i>AsyncQueue</i> class. Files are loaded in a separate thread, so the main application stays responsive.</p>
<p>Meshes and textures are added to the loading queue, and the system listens for events to know when each resource is ready. When a mesh finishes loading, it's removed from the queue. For textures, an event handler is used to handle their completion. The sample also demonstrates how to group and manage resource requests, making it easier to control the loading process.</p>
<p>This kind of async loading is useful for streaming large levels, loading assets on demand in VR, or preloading data in simulations without freezing the interface.</p>
]]>
</brief>
</desc>
<link_docs>https://developer.unigine.com/docs/api/library/filesystem/class.asyncqueue?rlang=cpp</link_docs>
<tags>
<tag>Systems</tag>
<tag>Optimization</tag>
<tag>File System</tag>
<tag>Multithreading</tag>
</tags>
<keywords>Asynchronous,Threads,Sync,Async,AsyncQueue</keywords>
</sample>
<sample title="Asynchronous Nodes Loading Stress-Test" id="asynchronous_nodes_loading_stress_test" category_id="multi_threading_performance_optimization">
<sdk_desc><![CDATA[Asynchronous node loading via <i>AsyncQueue</i> with main-thread spatial integration.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to asynchronously load large number of nodes using the <i>AsyncQueue</i> class while ensuring correct activation on the main thread.</p>
<p>In UNIGINE, world nodes must be created only from the main thread. To comply with this restriction and avoid blocking the main thread, the sample performs the initial node loading in a background thread, and then schedules a follow-up task on the main thread to finalize activation by calling <i>updateEnabled()</i> - a method that registers the node and its children in the world's spatial structure.</p>
<p>With the built-in Profiler enabled, you can observe how the engine handles increasing load smoothly and avoids frame spikes.</p>
]]>
</brief>
</desc>
<link_docs>https://developer.unigine.com/docs/api/library/filesystem/class.asyncqueue?rlang=cpp</link_docs>
<tags>
<tag>Systems</tag>
<tag>Optimization</tag>
<tag>File System</tag>
<tag>Multithreading</tag>
</tags>
<keywords>Asynchronous,Threads,Sync,Async,AsyncQueue</keywords>
</sample>
<sample title="Asynchronous Tasks Scheduler Configuration" id="asynchronous_tasks_scheduler_configuration" category_id="multi_threading_performance_optimization">
<sdk_desc><![CDATA[Managing tasks via <i>AsyncQueue</i> class with dirrefent thread types, parallel execution and frame control.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstates how to schedule and run different types of tasks using the <i>AsyncQueue class</i>. It shows how to execute operations in different thread types, control thread count, and choose whether tasks should complete within the current frame or run freely in the background.</p>
<p> - <b>Async</b> - non-blocking execution in a single thread. Useful for offloading tasks without stalling the main thread.</p>
<p> - <b>Async Multithread</b> - parallel execution across multiple threads. Each thread receives its own portion of work. Does not block the caller.</p>
<p> - <b>Frame-Async Multithread</b> - same as <b>Async Multithread</b>, but ensures all threads complete their tasks within the current frame.</p>
<p> - <b>Sync Multithread</b> - multi-threaded execution that blocks the calling thread until all threads finish.</p>
<p> - <b>Frame-Sync Multithread</b> - same as <b>Sync Multithread</b>, but ensures all threads complete their tasks within the current frame.</p>
]]>
</brief>
</desc>
<link_docs>https://developer.unigine.com/docs/api/library/filesystem/class.asyncqueue?rlang=cpp</link_docs>
<tags>
<tag>Systems</tag>
<tag>Optimization</tag>
<tag>File System</tag>
<tag>Multithreading</tag>
</tags>
<keywords>Asynchronous,Threads,Sync,Async,AsyncQueue</keywords>
</sample>
<sample title="CPU Shader Usage" id="cpu_shader_usage" category_id="multi_threading_performance_optimization">
<sdk_desc><![CDATA[Multi-threaded update of multiple <i>ObjectMeshCluster</i> instances on the CPU side using the <i>CPUShader</i> class.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to implement a custom CPU shader by inheriting from the <i>CPUShader</i> class to perform multi-threaded data processing outside the main rendering loop.</p>
<p>The system updates multiple <i>ObjectMeshCluster</i> instances asynchronously by using a helper <i>AsyncCluster</i> structure. Each cluster maintains two versions of itself: one for rendering and one for background updates. At the end of each frame, the two are swapped so the visible cluster always shows the latest result without stalling the frame.</p>
<p>This approach is particularly effective for real-time procedural animation, large-scale mesh updates, or any CPU-side logic that benefits from multithreading while remaining synchronized with rendering.</p>
]]>
</brief>
</desc>
<tags>
<tag>Optimization</tag>
<tag>Shaders</tag>
<tag>Multithreading</tag>
</tags>
<keywords>CPU,Shader,CPUShader,Cluster,Update</keywords>
</sample>
<sample title="Custom Threads" id="custom_threads" category_id="multi_threading_performance_optimization">
<sdk_desc><![CDATA[Creating and running custom threads using the <i>Unigine::Thread</i> class.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample shows how to define and manage background threads in <b>UNIGINE</b> by inheriting from the <i>Thread</i> class and overriding the <i>process()</i> method.</p>
<p>Two custom thread types are demonstrated:</p>
<p> - <b>InfiniteThread</b> - continuously outputs messages while running.</p>
<p> - <b>CountedThread</b> - performs a finite number of iterations before completing.</p>
<p>Threads are started during component initialization and executed in parallel with the main engine loop. The infinite thread is explicitly stopped via <i>stop()</i> once the counted thread completes all iterations.</p>
<p>This sample illustrates basic principles of multithreading and can serve as a foundation for offloading computations or <i>I/O</i> operations from the main thread.</p>
]]>
</brief>
</desc>
<tags>
<tag>Optimization</tag>
<tag>Multithreading</tag>
</tags>
<keywords>CPU</keywords>
</sample>
<sample title="Microprofiler Custom Counters" id="microprofiler_custom_counters" category_id="multi_threading_performance_optimization">
<sdk_desc><![CDATA[Using <i>Microprofile</i>, an advanced CPU/GPU profiler, to track performance and estimate the time spent on different sections of code.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates methods for tracking performance and estimating the time spent on different sections of code. For this purpose, it uses <b>Microprofile</b>, an advanced CPU/GPU profiler with per-frame inspection support.</p>
<p>Profiling is crucial for identifying performance bottlenecks and optimizing code execution. This analysis helps you understand if any code sections negatively impact the project's speed.</p>
]]>
</brief>
</desc>
<exec>microprofile_enabled 1</exec>
<edit>microprofile_enabled 1</edit>
<tags>
<tag>Optimization</tag>
<tag>Profiling</tag>
</tags>
</sample>
<sample title="Multiple Async Raycast Requests" id="multiple_async_raycast_requests" category_id="multi_threading_performance_optimization">
<sdk_desc><![CDATA[Launching and managing a large number of asynchronous ray-based intersection queries simultaneously.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to launch and manage a large number of asynchronous ray-based intersection queries simultaneously.</p>
<p>The results are visualized in real time and latency statistics are displayed for performance analysis.</p>
<p>This approach is useful for stress-testing intersection systems, profiling async request latency, or building interactive tools relying on high-frequency spatial queries.</p>
]]>
</brief>
</desc>
<tags>
<tag>Optimization</tag>
<tag>Multithreading</tag>
<tag>Intersections</tag>
</tags>
<keywords>Asynchronous</keywords>
</sample>
<sample title="Single Async Raycast Request" id="single_async_raycast_request" category_id="multi_threading_performance_optimization">
<sdk_desc><![CDATA[Performing a single asynchronous intersection query based on the user's mouse cursor position in the scene.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to perform a single asynchronous intersection query based on the user's mouse cursor position in the scene. The result includes the hit point and surface normal, which are visualized in the scene, along with latency information.</p>
<p>This setup demonstrates how to implement non-blocking intersection queries suitable for object selection or similar real-time input-driven interactions.</p>
]]>
</brief>
</desc>
<tags>
<tag>Optimization</tag>
<tag>Multithreading</tag>
<tag>Intersections</tag>
</tags>
<keywords>Asynchronous</keywords>
</sample>
<sample title="Experimental Navigation Mesh" id="experimental_navigation_mesh" category_id="navigation">
<sdk_desc><![CDATA[Configuring pathfinding between two points around obstacles using <b>Experimental Navigation Mesh</b>.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how to configure pathfinding between two points with obstacles using <b>Experimental Navigation Mesh</b>. The route is built for an agent of a certain size, so a path is only found where the agent actually fits: it keeps clear of walls and obstacles, avoids slopes too steep to walk up and steps too high to climb, and gives up when the way around becomes too long. The resulting route is reported with its length, cost, and number of points, and if the target cannot be reached, the path is drawn up to the last point the agent can get to, with the reason explained. </p>
<p>This sample is useful for pathfinding in games, for route checks in training simulators and digital twins, and for verifying that a building model stays passable for a given size.</p>
]]>
</brief>
</desc>
<link_docs>https://developer.unigine.com/docs/objects/navigations/experimental/index?rlang=cpp</link_docs>
<controls>
<![CDATA[
<p>Move the path endpoints and obstacles in the scene with the <b>widget manipulator</b>.<br/>
<b>LMB</b> click on object to show the manipulator.<br/>
<b>W</b> - switch the manipulator to movement mode<br/>
<b>E</b> - switch the manipulator to rotation mode<br/>
<b>F</b> - focus the camera on the selected object<br/>
<b>U</b>, <b>Esc</b> - deselect the object</p>
]]>
</controls>
<tags>
<tag>Navigation & Pathfinding</tag>
</tags>
</sample>
<sample title="Experimental Navigation Mesh Character" id="experimental_navigation_mesh_character" category_id="navigation">
<sdk_desc><![CDATA[Moving an animated character over an <b>Experimental Navigation Mesh</b> with the root motion of the animation graph.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates an animated character walking to a target over an <b>Experimental Navigation Mesh</b>. The character's movement along the route is taken from the root motion of the locomotion animations.</p>
<p>Drag the target material ball with the manipulator and the character replans their route and walks to the new place. The locomotion settings can be adjusted in the <i>Parameters</i> section.</p>
<p>The <i>Status</i> block reports the route state, the current animation state, the velocity the character actually moves at, and the rate the walk animation is played at.</p>
<p>This sample is useful for animated agents navigating a scene: characters in games, pedestrians in a simulation, any unit whose animation is expected to drive its movement.</p>
]]>
</brief>
</desc>
<link_docs>https://developer.unigine.com/docs/objects/navigations/experimental/index?rlang=cpp</link_docs>
<controls>
<![CDATA[
<p>Move the target node in the scene with the <b>widget manipulator</b>.<br/>
<b>LMB</b> click on object to show the manipulator.<br/>
<b>W</b> - switch the manipulator to movement mode<br/>
<b>F</b> - focus the camera on the selected object<br/>
<b>U</b>, <b>Esc</b> - deselect the object</p>
]]>
</controls>
<tags>
<tag>Navigation & Pathfinding</tag>
</tags>
</sample>
<sample title="Experimental Navigation Mesh Conversion" id="experimental_navigation_mesh_conversion" category_id="navigation">
<sdk_desc><![CDATA[Converting navigation data between the classic <b>Navigation Mesh</b> and the <b>Experimental Navigation Mesh</b>.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates how navigation data can be moved between the classic <b>Navigation Mesh</b> and the <b>Experimental Navigation Mesh</b>.</p>
<p>Both are baked by the same experimental navigation baker from one shared set of settings over the same scene geometry, so the two results can be compared side by side. Their data, however, is kept in different formats: the classic node stores a polygon mesh in a <b>.mesh</b> file, the experimental one a tiled <b>.navmesh</b> asset. The sample converts the data of one node into the format of the other: the classic mesh can be converted into the experimental format and back in memory, or exported to a <b>.mesh</b> file.</p>
<p>The experimental system bakes the walkable surface from the scene geometry instead of areas placed by hand, streams it in tiles for worlds too large to fit in memory, and supports area volumes with their own cost.</p>
<p>This sample is useful when moving a project to the new navigation system: the navigation already prepared for the classic node can be carried over as it is, and the two systems can run side by side while the migration is in progress.</p>
]]>
</brief>
</desc>
<link_docs>https://developer.unigine.com/docs/objects/navigations/experimental/index?rlang=cpp</link_docs>
<controls>
<![CDATA[
<p>Move the navigation mesh nodes in the scene with the <b>widget manipulator</b>.<br/>
<b>LMB</b> click on object to show the manipulator.<br/>
<b>W</b> - switch the manipulator to movement mode<br/>
<b>E</b> - switch the manipulator to rotation mode<br/>
<b>F</b> - focus the camera on the selected object<br/>
<b>U</b>, <b>Esc</b> - deselect the object</p>
]]>
</controls>
<tags>
<tag>Navigation & Pathfinding</tag>
</tags>
</sample>
<sample title="Experimental Navigation Mesh Crowd" id="experimental_navigation_mesh_crowd" category_id="navigation">
<sdk_desc><![CDATA[Moving a crowd of agents over an <b>Experimental Navigation Mesh</b> with collision avoidance.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates a crowd of agents moving over an <b>Experimental Navigation Mesh</b>, each one planning its own route and steering around the others on the way. Before an agent moves, it evaluates its neighbors and adjusts its speed and direction to avoid a collision. The crowd starts with a hundred agents and can be restarted with ten to three hundred.</p>
<p>The sample provides three navigation scenarios:</p>
<p> - <b>Bottleneck</b> - two teams on the opposite sides of a wall swap places, each agent taking the shortest route through the gates</p>
<p> - <b>Circle</b> - the agents are placed on a circle and head for its diametrically opposite point</p>
<p> - <b>Wander</b> - the agents walk between random points of the mesh</p>
<p>The <i>Status</i> block reports the current scenario, the number of agents, and how many goals they have reached. <i>Agents without a route</i> is a diagnostic counter: anything above zero means an agent was spawned off the mesh or cannot reach its target.</p>
<p>This sample is useful for crowds of characters in games, for pedestrian and evacuation simulations, and for any scene where many units or vehicles share the same space.</p>
]]>
</brief>
</desc>
<link_docs>https://developer.unigine.com/docs/objects/navigations/experimental/index?rlang=cpp</link_docs>
<tags>
<tag>Navigation & Pathfinding</tag>
</tags>
</sample>
<sample title="Experimental Navigation Mesh Demo" id="experimental_navigation_mesh_demo" category_id="navigation">
<sdk_desc><![CDATA[Configuring pathfinding to multiple targets on a plane with obstacles using <b>Experimental Navigation Mesh</b>.]]></sdk_desc>
<desc>
<brief>
<![CDATA[ <p>This sample demonstrates several material balls collecting coins on a plane with obstacles, navigating around by means of an <b>Experimental Navigation Mesh</b>. Each ball looks for its own way to the coin and follows it, staying on the navigation mesh as it moves; once a coin is collected, the next one appears elsewhere. Every ball has its own tab, so they can be given different settings and compared while they move - the ball being edited is highlighted in the scene.</p>
<p>This sample is useful for crowds and groups of units in games, and for simulations where many vehicles or machines move through the same space at once.</p>