Unreal DataStreams Guide
This guide was written as a quick reference step by step guide for setting up a simple Unreal datastream. For more in depth information on each step please check the documentation at https://www.genvidtech.com/for-developers/sdk-latest/
Download Clock Assets
Download the folder containing the assets for this guide
Import “clock_face” as a texture after creating your project (or you can drag and drop the clock folder into your content folder in explorer to get a pre-built clock)
Clock Setup
If you dragged and dropped the clock folder into your content folder skip this section
Create an object of type “Sprite” (Paper2d->Sprite)
Set the source texture as “clock_face”
Create a material and set it’s color to be black
Create a blueprint actor. Attach the following components:
A scene component attached to the default scene root named “Clock”
A scene component attached to “Clock” named “HourHand”
A cube component attached to “HourHand” named “HourHandCube”
Set the location to 75, 0, 0
Set the scale to 1.5, 1, .15
Set the material to the material created above
A scene component attached to “Clock” named “MinuteHand”
A cube component attached to “MinuteHand” named “MinuteHandCube”
Set the location to 0, 0, 100
Set the scale to .1, 1, 2
Set the material to the material created above
A scene component attached to “Clock” named “SecondHand”
Set the rotation to 0, 45, 0
A cube component attached to “SecondHand” named “SecondHandCube”
Set the location to 50, 0, 0
Set the scale to 1, 1, .075
Set the material to the material created above
A paper sprite component attached to “Clock” named “Face”
Set the Source Sprite property to the sprite created above
Finished component list for the clock
Create a function called “GetAngle”. This will be used to calculate an angle from a hour, minute, or second
It should have 3 float inputs: Min, Max, and Value
It should have 1 float output: Angle
Call “Normalize to range” passing in the value, min, and max inputs
Call “Lerp”. A is 360, B is 0, and Alpha is the value returned by “normalize to range”
Return the value returned by Lerp
GetAngle function
Create 3 variables of type float on the blueprint. Hour, Minute and Second.
On tick we want to set the hour value
The hour value should be in a 0 - 12 hour format allowing for decimals along the way. This value should then be passed into GetAngle. See the image below
-
Tick function for the Clock
The Minute value should be between in a 0 - 60 format allowing for decimals along the way. This value should then be passed into Get Angle. See the image below
Tick function for the clock (continuation from above)
The Second value should be between in a 0 - 60 format allowing for decimals along the way. This value should then be passed into Get Angle. See the image below
Tick function for the clock (continuation from above)
Set the Pitch of the “HourHand”, “MinuteHand”, and “SecondHand” using “SetRelativeRotation” and the values calculated for each. See the below image
Note 60 will have to be added to the hour angle, and 90 will have to be added to the second hand
Tick function for the clock (continuation from above)
Add the Clock blueprint actor to the level in view of the camera. Confirm it is working correctly by hitting play

Blueprint Implementation
On the GenvidStream blueprint create the following function
GenvidStream function
We form a JSON string inserting the time now when appropriate
The final format should be: {“hour”:”<hour>”,”minute”:”<minute>”,”second”:”<second>”}
On BeginPlay for the GenvidStream blueprint add the following blueprint code
BeginPlay of GenvidStream
Custom event on GenvidStream
We make a GenvidStream named “ClockTime” with framerate 30 and assign it to the first element in the array “Streams” that already exists on GenvidStream objects
We bind the New GenvidStream to a new custom event. This custom event calls the function created above and submits the returned string as a stream