c# - A kinect cursor in unity -
I want to be able to work on the cursor in unity while using Connect. It is necessary that I do it as a plugin in the form of a Kinect SDK as plugin and not using Openya, IVE managed to do half of it but it is not really true. At this time ive worked on the X axis, but it does not cover the entire screen. It would be more ideal as per the beginning of the cursor at the center of the screen. At the moment when moving towards the right side of the screen, it goes half way. I do not count the hard codes in a float number but rather the screen. Unity was such a ceremony where you can increase the world
Zero update () {if (sw.pollSkeleton ()) {distance.x = sw.bonePos [0,2] .x - sw.bonePos [0,7] .x; // bonops 0,2 spinal cord 0.7 is left / spinal position usually (0.1,1.2,0.3) / * debug. The log ("distance" + distance.x); * / / * * (-0.2,1.4,0.7) hand on the left side. // Originally near the particles this trime * (-0.3,1.0,0.6 ) Hand resonably high (-0.4,1.0,0.7) shoulder meaning anything 1.0 area * (-0.20.6,0.7) hand low torso level cursor should be alive then * (-) * (-0.1,0.7,0.3) Hands on hand should not be visible Cursor (-0.1,0.5,0.3) 0.0 - 0.1 * * / / * * (0.3,1.3,0.8) Right side * (0.21.0.0.8) Right hand on left hand on the other hand Right Shoulder (0.41.0.0.7) forward right * (0.3, 0.9,0.7) lower arm downwards, but right * (0.3,0.7,0.6) pointing to the hand Dying * (0.2,0.7,0.5) hands below the waist and spinal cord * / // If the left hand is less than the x axis spinal cord // If (sw.bonePos [0,7] .x & Lt; sw.bonePos [0,2] .x) {// distance 0.2053766 * -0.5f difference = -0.5f * distance.x; // difference going -0.1026883 debug log ("left hand is over Is ");} if (sw.bonePos [0,7] .x> gt; sw.bonePos [0,2]. X) {difference = -0.8f * distance.x; debug log (" hand right More than ");} Debug log (" district: "+ distance. X +", def: "+ difference); Debug.Log ("located on the vertebrae:" + sw.bonePos [0,2] + "is the left hand:" + sw.bonePos [0,7] + "position of the cursor" + conversion post); }} Zero OnGUI () {// width above height = new rake (screen.width * (difference + 0.3f), 0.5 f * screen. Height, 100,100); /screen.width 480 * 0.1973117,0.5f * 1280,100,100 * * * * / GUI Label (r, cursor); //GUI.DrawTexture (); }}
I have not worked with unity, so I'm unfortunately not directly I can say code for Unity - but I have posted the code for the first KNAT SDK. I have included the source code which in front of the screen creates a bounding box around the player to represent the screen in response to this question. Is:
The code in the above post is a box
at the bottom of the screen shoulders = top left shoulder = top left screen Most To get more screen position, I take the distance between left and amp; Right shoulder and add it to the right shoulder position.
It provides a comfortable area that allows the screen to move the cursor around the screen. It easily scales different players of different sizes, and it will not work anytime where the player stands inside the FOV of Kinect.
This concept should be compatible with Unity code.
Comments
Post a Comment