Joint.JointType が set できないのは公式バグ(古い情報)
この記事は古い情報です。SDK 1.5 以降では表記が get のみに書きかえられて問題が解決されています。引き続き set はできません。
次の様にして Joint のインスタンスを任意に生成して、JointTypeを設定しようとするとエラーが出ます。
Joint joint = new Joint(); joint.JointType = JointType.Head;
SDK 1.0 に含まれるの公式のドキュメントでは、「Gets or sets the type of joint.」って書かれていることが確認できます。しかしながら VisualStudio などから Joint の定義を確認すると、set アクセサが公開されていないことが確認できます。
using System; using System.Diagnostics; namespace Microsoft.Kinect { [Serializable] [DebuggerDisplay("Position:{Position} JointType:{JointType}TrackingState:{TrackingState}")] public struct Joint { public static bool operator !=(Joint joint1, Joint joint2); public static bool operator ==(Joint joint1, Joint joint2); public JointType JointType { get; internal set; } public SkeletonPoint Position { get; set; } public JointTrackingState TrackingState { get; set; } public bool Equals(Joint joint); public override bool Equals(object obj); public override int GetHashCode(); } }
このように、JointType は internalに設定されています。internal は同一アセンブリ以外から参照不可能にする設定です。端的に言えば、SDK を利用して作られる全てのサードアプリケーション・ライブラリから設定不可ということになります。
補足情報
念のためこれについて公式に尋ねてみました。次のURLの通りです(前に質問している方がいらっしゃいました)。
そんなわけで Kinectの中の人から返信がありましたが、公式バグとのことでした。今後の変更等については言及されていませんが、きちんと整備されることに期待します。