Getting source reference from avatar ID in Unreal

I have a dilema. Running two livelinks with two cameras (spaced apart) into one UE project, all works well, connecting to both providers, but need to find out which generated avatar belongs to which provider. So let’s say I have Avatar_livelink_C_2 and Avatar_livelink_C_4 added/generated, but need to know which camera it’s data coming from. So I would know if C_2 is on left camera or right camera.

Thanks a bunch.

Hi,

I think the first step is to have a different name for each live link source.
By default, the name of the live link source is “ZED” (here : https://github.com/stereolabs/zed-livelink-plugin/blob/main/Source/Private/main.cpp#L91).
You can, for example, add the serial number of your camera or rename it completely to be able to recognize it in UE.

Then, in UE, in the level blueprint of the Map (where the avatars are spawned based of the detection), you will be able to know from which source the detection is coming from by using its name (I think it’s called “Source Type” in UE).

Best regards,
Benjamin Vallon

Stereolabs Support

I have named each source differently in main.cpp, but cannot get this “Source Type” from any of the Current Subject variables, could you give a more information or illustration where to get the “Source Typoe” from.
Thank you!

I think you are right, you can access the name of the Source via the Live link Source Handle, but I don’t see how you can know from which Source each Subject is coming from.

The workaround would be to add the name of the source in each subject’s name.
For the moment, the name of the subject is only the ID provided by the detection module.
You can, for example, add the Source’s name as a prefix. That way you can filter each detection with its name and you avoid duplicates (you can have two ID 1 for example, one for each camera).

The name is set here in the code : https://github.com/stereolabs/zed-livelink-plugin/blob/main/Source/Private/main.cpp#L295.

Best,
Benjamin V.

Stereolabs Support

It sounds like a good solution, but when I just add prefix to the id and it’s passed into blueprints, breaks the logic. Unless I’m adding prefix incorrectly. Can you give me an example of adding a prefix please.

Hi,

The name of the “Subject” is set in the cpp code. Instead of using the ID of the detection, use something like “LeftCamera_” + FString::FromInt(objectData.id). I’ve not tested it but it should work.

Which part of the blueprint does not work ?

Best,
Benjamin

Stereolabs Support

Stops at Evaluate Live Link Frame and no avatars are being generated.

Make sure you updated the Subject name here (https://github.com/stereolabs/zed-livelink-plugin/blob/main/Source/Private/main.cpp#L295) and also here : https://github.com/stereolabs/zed-livelink-plugin/blob/main/Source/Private/main.cpp#L129.

I’ll try to improve that and make it easier to modify in the future.

Best,
Benjamin V

Stereolabs Support

Line 129 ? UpdateAnimationFrameData(it.Value); ?

Yes, it updates the skeleton data of the current detection (Here it.Value is the ID as the skeletons are store in a map).

Stereolabs Support

but it.Value is int, can’t add append a string to it ?

What I meant is that you have to change the Subject name in UpdateSkeletonStaticData() and UpdateAnimationFrameData(). I linked the wrong line indeed, the exact line to modify is l.368 I think.

Stereolabs Support

I have also added ID index to RemoveSubject l. 308 otherwise “dead” avatars are left in the world outliner.

Thanks so much for your help, would be good if you could add avatar>camera identification procedure in your next release.

We planned some “quality of life” improvements of the live link sample for the next release.

I’ll see what can be done.

Best,
Benjamin Vallon

Stereolabs Support