Azure Kinect DK, Body tracking: Mapping separate avatars on separate skeletons - c#

To recreate my issue, I've setup a project in Unity3d 2020, using this sample project.
Here I can successfully map an avatar to a single skeleton. In my project, however, I want to map multiple skeletons - not only the closest, as the sample provides.
This far I've successfully rendered multiple skeletons, but when I try to map separate avatars on each of them - the two avatars will follow the motion of only one of the skeletons in the scene.
The following code is used to setup the avatars:
var avatarPrefab = Instantiate(avatarPrefab, new Vector3(0,0,0), Quaterion.identity);
avatarPrefab.GetComponent<PuppetAvatar>().KinectDevice = this;
avatarPrefab.GetComponent<PuppetAvatar>().CharacterRootTransform = avatarPrefab.transform;
avatarPrefab.GetComponent<PuppetAvatar>().RootPosition = this.transform.GetChild(i).transform.GetChild(0).gameObject; // gets the pelvis of each "rootBody" prefab.
The creator of the PuppetAvatar.cs script has yet to release any updates to support multibody tracking, but I posed a similar question in this thread.

Take a look at MoveBox: https://github.com/microsoft/MoveBox-for-Microsoft-Rocketbox
Movebox can parser the SMPL body models extracted by an external tool for 3D multi-person human pose estimation from RGB videos.
And it supports Azure Kinect DK

Related

Resizing shapess within shapes in Visio using C#

So I am using the Microsoft.Office.Interop.Visio Class Library and I am trying to write C# to automate the creation of topology diagrams. This particular topology diagram needs to have three different network zones and depending on the purpose of the server, it will go into the proper network zone. The network zones are shapes themselves, as well as shapes for the servers.
My challenge is that when the program is fed a data file that specifies the type of servers needed, I need to make sure that the servers are put into the right zones and that the zone is resized to fit the shapes properly.
I am at a point where I can successfully add the server shapes to a new diagram and have them connect to each other using the Shape.Autoconnect method. However, I am stuck on figuring out how I am supposed to accomplish what I described above.
Any thoughts/guidance would be appreciated. Thank you!
Adding shapes to new diagram
Master visioConnectorShapeHttps = visioStencil.Masters.get_ItemU(#"HTTPS Line");
Master visioConnectorShapeSQL = visioStencil.Masters.get_ItemU(#"SQLConnection");
Master visioWebRoleMaster = visioStencil.Masters.get_ItemU(#"Azure PaaS WebRole Tier");
Shape visioWebRoleShape = visioPage.Drop(visioWebRoleMaster, 10, 16);
Master visioWorkerRoleMaster = visioStencil.Masters.get_ItemU(#"Azure PaaS WorkerRole Tier");
Shape visioWorkerRoleShape = visioPage.Drop(visioWorkerRoleMaster, 10, 10);
visioWebRoleShape.AutoConnect(visioWorkerRoleShape, VisAutoConnectDir.visAutoConnectDirDown, visioConnectorShapeHttps);
Master visioSQLIaaSMaster = visioStencil.Masters.get_ItemU(#"Azure IaaS Database Tier");
Shape visioSQLIaaSShape = visioPage.Drop(visioSQLIaaSMaster, 10, 3);
visioWorkerRoleShape.AutoConnect(visioSQLIaaSShape, VisAutoConnectDir.visAutoConnectDirDown, visioConnectorShapeSQL);
I would like to programmatically feed the app a data file and automate the creation of a topology diagram where server shapes properly fit into various proper network zone shapes.

How to fix the scaling/positioning problem in helix3d models?

Problem:
I am trying to create and render detailed building models with helixtoolkit.wpf.sharpdx. And some part of the model (mostly detailed furnishing and piping structures inside the house) is mis-scaled and mis-positioned at the first sight.
I am new here, and don't have enough reputations to post images yet
1.first sight
2.lamps?
However, if I carefully move my viewpoint(camera?) into the house, and some of the inside structures start to show. After wondering around the entire inside space of the house, and pulling back my viewpoint to the outside world, the rendered scene seems perfect.
3.lamps!
4.correct scene
(The calculation and assembling process for the 3d model should be correct.)
Questions:
Is there any important step I'm missing?
Are there possible workarounds to ensure the scene is rendered correctly?
May I and should I try to "walk" the camera around programmatically to achieve the correctly rendered scene?
Hope that I've described my problem clear enough.
Any suggestion is helpful!
Model3DCollection collection; //pre-assembled data
ObservableElement3DCollection obCollection = new ObservableElement3DCollection();
foreach (var m3d in collection)
{
if (m3d is GeometryModel3D gm3D)
{
MeshGeometry3D meshGeometry3D = gm3D.Geometry as MeshGeometry3D;
HelixToolkit.Wpf.SharpDX.MeshGeometry3D meshGeometry = CastGeometry(meshGeometry3D);
var model = new MeshGeometryModel3D()
{
Material = CastMaterial(gm3D.Material),
Transform = m3d.Transform,
Geometry = meshGeometry,
CullMode = CullMode.Front
};
meshGeometry.UpdateOctree();
obCollection.Add(model);
}
}
OnPropertyChanged(nameof(obCollection));
//...
Are you using separate thread instead of UI thread to load your models?
Seems like the transforms are not getting updated.
Make sure following is running in UI thread:
var model = new MeshGeometryModel3D()
{
Material = CastMaterial(gm3D.Material),
Transform = m3d.Transform,
Geometry = meshGeometry,
CullMode = CullMode.Front
};
obCollection.Add(model);

How to recieve input from HTC Vive tracker into Unity?

I am attatching an HTC Vive tracker to a real life object to use that object in game. The tracker is found in the game itself and the movement and rotation are updated perfectly fine. But getting the input to work is the problem here. The Tracker its pins are connected correctly and the input can be seen working in the Input Debugger in the SteamVR Input Binding Tool.
I have tried to find any help on the internet but everything seems to be outdated. The controller themselves do work with the custom input function I have added but the tracker refuses to work. There are no errors at all. The code simply calls a shoot function to shoot a bullet out of a gun. The input is recieved by the controller, both of them, but the tracker which has the exact same settings as the controllers doesn't seem to work.
[SerializeField] private GunScript gunScript;
[SerializeField] private SteamVR_Action_Boolean input;
void Update()
{
if (input.stateDown)
{
gunScript.Shoot(gunScript.ShotTransform.rotation);
}
}
The current output does shoot the gun when using the trigger which is set in the Input Binding Tool when using a normal controller, but when pressing the trigger attatched to the tracker nothing happens, no errors either.
// on start
var allDevices = new List<InputDevice>();
InputDevices.GetDevices(allDevices);
InputDevice tracker = allDevices.FirstOrDefault(d => d.role == InputDeviceRole.HardwareTracker);
// on update
tracker.TryGetFeatureValue(CommonUsages.devicePosition, out var pos);
tracker.TryGetFeatureValue(CommonUsages.deviceRotation, out var rot);
// NOTE!!! pos and rot are in world position so you have to translate it to floor
SteamVR_Action_Boolean.stateDown is a shortcut to SteamVR_Input_Sources.Any
but as you can see in SteamVR_Input_Sources there is no entry for trackers at all so also Any will not get a tracker input.
There are a ton of tutorials for how to get controller input but I also couldn't find anything about getting button input for Vive Trackers. Apparently this is not intended ...
It makes sense though since the button is also the Trackers connection/power button ... it would probably not be a good idea to make the User press that button in order to trigger some actions.
In their HTC_Vive_Tracker Guidelines they point to
If you encounter problems in enabling VIVETracker(2018)on Unityor Unreal, refer to the following links:
For Unity 3D developers:
Downloadlink for the ViveInputUtility package: AssetStore or GitHub
Vive Input Utility source code repository:https://github.com/ViveSoftware/ViveInputUtility-Unity
Maybe there is something helpfull there though it seems this is also more for controllers etc. not for getting the Tracker's button input.

Unity Create directory accessible by players

I am working on a game and want players to be able to place there own ships and islands into the game. I want players to be able to access folders which contain files which the ships use for configuration. How would I make and access these files?
i think you have to explain your question more to get more exact answer but i answer your question best i can.
technically its possible to let players modify directory of game their profile but i dont sujest that. if that was a music or a sound or something like that, you could just make a system for your game to play songs one after other like games like gta or other games menus. you can find that after a little search. but you are speaking of game content that needs to be controlled. is your game 3d or 2d? if its 3d should they be able to work with 3d modeling program? and you have to know after unity makes an output of your game, after players setup that, there will be no basic formats and unity packages them to assets format. its better to make a editor system for your game that players can modify what they want or choose what they want in game, as many games do this way.
this is example from unity official website. you can make your players add their files to your game:
// Opens a file selection dialog for a PNG file and overwrites any
// selected texture with the contents.
class EditorUtilityOpenFilePanel {
#MenuItem("Examples/Overwrite Texture")
static function Apply () {
var texture : Texture2D = Selection.activeObject;
if (texture == null) {
EditorUtility.DisplayDialog(
"Select Texture",
"You Must Select a Texture first!",
"Ok");
return;
}
var path = EditorUtility.OpenFilePanel(
"Overwrite with png",
"",
"png");
if (path.Length != 0) {
var www = WWW("file:///" + path);
www.LoadImageIntoTexture(texture);
}
}
}

C# XNA Loading in textures

I have having alot of issues loading in textures into my simple game. First off, I am able to load in a texture when im inside of "Game1.cs". However, I am currently trying to create a level. So I want to load in all the pictures in the Level class.
public Level(IServiceProvider _serviceProvider)
{
content = new ContentManager(_serviceProvider, "Content");
mNrOfTextures = 3;
mTextures[] = new Texture2D[mNrTextures];
mTextures[0] = Content.Load<Texture2D>("sky");
//And then more textures and other stuff..
}
But the program can never find the file sky. I dont really get any useful error messages and im moving away from any tutorials currently. Can anyone point me into the right direction?
Full path to file: C:\c++\ProjIV\ProjIV\ProjIVContent\
I personally just pass my ContentManager to my level class, instead of passing the service provider as others do.
In this case, you need to use your local content instance, not the static Content
mTextures[0] = content.Load<Texture2D>("sky");
EDIT: I see this did not work, can you attach a picture of your solution layout with the content?

Categories