简体   繁体   中英

Kinect v2 avatar controller with unity

I am trying to control 3D model with kinect v2. I am using Unity3D. I installed requiements. I drawed a point man. just like this pic:

[ 重点人物图片]

But when I try 3d character the character looks like this:

[ 3D角色]

This is my code:

  void FixedUpdate () {
    //GameObject tanımlanmış mı kontrolü yapılır.
    if (BodySourceManager == null) {

        return;

    }

    //Tanımlı olduğu için içindeki scriptin ataması yapılır.
    _BodyManager = BodySourceManager.GetComponent<BodySourceManager>();

    //Script ataması tamamlanlmış mı kontrolü yapılır.
    if (_BodyManager == null) {

        return;

    }
    //BodySourceManager scripti içerisindeki fonksiyon çağırılarak body değerleri alınır.
    Windows.Kinect.Body[] data = _BodyManager.GetData();

    //Data değerleri başarıyla atanmışmı kontrolü yapılır.
    if (data == null) {
        return;
    }
    //Takip edilebilir kaç kişi var ise onun id numarası kayıt altına alınır.
    List<ulong> trackedIds = new List<ulong>();
    foreach (var body in data) {
        if(body == null)
        {
            continue;
        }
        if (body.IsTracked) {
            trackedIds.Add(body.TrackingId);
            int JointOrder=0;
            foreach(var joints in jointTypes)
            {
                Windows.Kinect.Joint jointPoint = body.Joints[joints];

                Vector3 JointPositionV = new Vector3(jointPoint.Position.X, jointPoint.Position.Y, jointPoint.Position.Z);


                    BodyJoints[JointOrder].transform.position = JointPositionV * 20;
                JointOrder++;
            }

        }
    }

}

Why does the body look like a monster?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM