Getting following Error : Assets/Skeleton.cs(31,42): error CS0246: The type or namespace name `SkeletonJoint’ could not be found. Are you missing a using directive or an assembly reference?
How can i solve this…
using UnityEngine;
using System;
using System.Collections;
using OpenNI;
// Skeleton manager to detect kicks. We inherit from OpenNI's skeleton wrapper to get access to joint movement
public class Skeleton : OpenNISkeleton
{
// This struct holds the position of a joint with a time stamp. Managing a queue of these elements and adding a position each frame will give us the
// movement history of that joint, which can be used to calculate movement over time
struct VecHistoryElement
{
public VecHistoryElement(float timeStamp, Vector3 vec)
{
this.timeStamp = timeStamp;
this.vec = vec;
}
public float timeStamp;
public Vector3 vec;
};
private Vector3 lastLeftLegPos = new Vector3(0, 0, 0); // Save the last position of the left foot
private Queue leftLegHistory = new Queue(); // Holds the movement history of the left foot
private Vector3 lastRightLegPos = new Vector3(0, 0, 0); // Save the last position of the right foot
private Queue rightLegHistory = new Queue(); // Holds the movement history of the right foor
// OpenNI's skeleton tracker calls this method for every joint needing update
// ERROR OCCURS WHILE CALLING THE UpdateJoint() WITH ITS ARGUMENTS
public override void UpdateJoint(SkeletonJoint joint, SkeletonJointTransformation skelTrans)
{
// Call base method to update the whole skeleton
base.UpdateJoint(joint, skelTrans);
// If the current joint is the left foot, record it
if (joint == SkeletonJoint.LeftFoot)
{
// We only save 100 frames backwards, more than enough
if(leftLegHistory.Count > 100)
{
leftLegHistory.Dequeue();
}
// Get current foot position, calculate the delta movement from the last frame, and record it in the history queue
Vector3 currentLegPos = new Vector3(-skelTrans.Position.Position.X, skelTrans.Position.Position.Y, -skelTrans.Position.Position.Z);
leftLegHistory.Enqueue(new VecHistoryElement(Time.time, currentLegPos - lastLeftLegPos));
lastLeftLegPos = currentLegPos;
}
else if (joint == SkeletonJoint.RightFoot) // Same thing for right foot
{
if(rightLegHistory.Count > 100)
{
rightLegHistory.Dequeue();
}
Vector3 currentLegPos = new Vector3(-skelTrans.Position.Position.X, skelTrans.Position.Position.Y, -skelTrans.Position.Position.Z);
rightLegHistory.Enqueue(new VecHistoryElement(Time.time, currentLegPos - lastRightLegPos));
lastRightLegPos = currentLegPos;
}
}
// Get the movement vector fo the left foot over the given time period
public Vector3 GetSumDirectionLeftLegHistory(float period)
{
Vector3 sum = new Vector3();
do
{
VecHistoryElement v = (VecHistoryElement)leftLegHistory.Dequeue();
// For each position recorded, if it is within the requested timeframe, add it to the result vector
if(Time.time - v.timeStamp <= period)
{
sum += v.vec;
}
}
while (leftLegHistory.Count > 0);
return sum;
}
// Get the movement vector fo the right foot over the given time period
public Vector3 GetSumDirectionRightLegHistory(float period)
{
Vector3 sum = new Vector3();
do
{
VecHistoryElement v = (VecHistoryElement)rightLegHistory.Dequeue();
// For each position recorded, if it is within the requested timeframe, add it to the result vector
if(Time.time - v.timeStamp <= period)
{
sum += v.vec;
}
}
while (rightLegHistory.Count > 0);
return sum;
}
}