Hello sir,
I am developing a game using kinect.The game goes like ..user should be able to catch falling apples using basket.The basket is movable with kinect.So inside basket class i have wrtten the following code.
But the method world.getTrackedUser() is giving me null.
NewtonAppleWorld world = (NewtonAppleWorld) getWorld();
//Actor actor = getOneIntersectingObject(Actor.class);
//shivadeepthi-start
UserData user= world.getTrackedUser();
GreenfootImage image1=world.getThumbnail();
System.out.println(image1 +"image");
System.out.println(user+"user");
if(user!=null){
if(user.getNearestJoint()==Joint.RIGHT_HAND)
{
Joint rightHand= user.getJoint(Joint.RIGHT_HAND);
getImage().drawImage(image,rightHand.getX(),rightHand.getY());
}else
if(user.getNearestJoint()==Joint.LEFT_HAND){
Joint leftHand=user.getJoint(Joint.LEFT_HAND);
getImage().drawImage(image,leftHand.getX(),leftHand.getY());
}
}
please help me out.
Thanks,
seepthi