public Avatar(Game game, RetargetMatrixHierarchyToAvatarMesh retarget, Vector3 skeletonTranslationScaleFactor) : base(game) { if (null == game) { return; } this.SkeletonTranslationScaleFactor = skeletonTranslationScaleFactor; label3 = new Label(game, new Vector2(5.0f, 65.0f)); Game.Components.Add(label3); this.retargetMethod = retarget; this.SkeletonDrawn = true; this.useKinectAvateering = true; this.jointPositionFilter = new Kandou_v1.Filters.SkeletonJointsPositionDoubleExponentialFilter(); this.boneOrientationFilter = new Kandou_v1.Filters.BoneOrientationDoubleExponentialFilter(); this.mirrorView = true; var jointPositionSmoothParameters = new TransformSmoothParameters { Smoothing = 0.25f, Correction = 0.25f, Prediction = 0.75f, JitterRadius = 0.1f, MaxDeviationRadius = 0.04f }; this.jointPositionFilter.Init(jointPositionSmoothParameters); var boneOrientationSmoothparameters = new TransformSmoothParameters { Smoothing = 0.5f, Correction = 0.8f, Prediction = 0.75f, JitterRadius = 0.1f, MaxDeviationRadius = 0.1f }; this.boneOrientationFilter.Init(boneOrientationSmoothparameters); }
public Avatar(Game game, RetargetMatrixHierarchyToAvatarMesh retarget, Vector3 skeletonTranslationScaleFactor) : base(game) { if (null == game) { return; } this.SkeletonTranslationScaleFactor = skeletonTranslationScaleFactor; label3 = new Label(game, new Vector2(5.0f, 65.0f)); Game.Components.Add(label3); this.retargetMethod = retarget; this.SkeletonDrawn = true; this.useKinectAvateering = true; this.jointPositionFilter = new Kandou_v1.Filters.SkeletonJointsPositionDoubleExponentialFilter(); this.boneOrientationFilter = new Kandou_v1.Filters.BoneOrientationDoubleExponentialFilter(); this.mirrorView = true; var jointPositionSmoothParameters = new TransformSmoothParameters { Smoothing = 0.25f, Correction = 0.25f, Prediction = 0.75f, JitterRadius = 0.1f, MaxDeviationRadius = 0.04f }; this.jointPositionFilter.Init(jointPositionSmoothParameters); var boneOrientationSmoothparameters = new TransformSmoothParameters { Smoothing = 0.5f, Correction = 0.8f, Prediction = 0.75f, JitterRadius = 0.1f, MaxDeviationRadius = 0.1f }; this.boneOrientationFilter.Init(boneOrientationSmoothparameters); }
/// <summary> /// Initializes a new instance of the AvatarAnimator class. /// </summary> /// <param name="game">The related game object.</param> /// <param name="retarget">The avatar mesh re-targeting method to convert from the Kinect skeleton.</param> public AvatarAnimator(Game game, RetargetMatrixHierarchyToAvatarMesh retarget, Vector3 skeletonTranslationScaleFactor) : base(game) { if (null == game) { return; } this.SkeletonTranslationScaleFactor = skeletonTranslationScaleFactor; this.retargetMethod = retarget; this.SkeletonDrawn = true; this.useKinectAvateering = true; this.AvatarHipCenterHeight = 0; // Create local axes inside the model to draw at each joint this.localAxes = new CoordinateCross(this.Game, 2f); this.drawLocalAxes = false; game.Components.Add(this.localAxes); // If we draw the Kinect 3D skeleton in BoneOrientationConstraints, we can offset it from the original // hip center position, so as not to draw over the top of the Avatar. Offset defined in m. this.kinectLineSkeletonWorldOffsetMatrix = Matrix.CreateTranslation(this.SkeletonTranslationScaleFactor.X, 0.75f * this.SkeletonTranslationScaleFactor.Y, 0); this.drawBoneConstraintsSkeleton = false; // Skeleton fixups this.frameTimer = new Timer(); this.lastNuiTime = 0; this.FloorClipPlane = new Tuple <float, float, float, float>(0, 0, 0, 0); this.clippedLegs = new SkeletonJointsFilterClippedLegs(); this.sensorOffsetCorrection = new SkeletonJointsSensorOffsetCorrection(); this.jointPositionFilter = new SkeletonJointsPositionDoubleExponentialFilter(); this.boneOrientationConstraints = new BoneOrientationConstraints(game, this.SkeletonTranslationScaleFactor); this.boneOrientationFilter = new BoneOrientationDoubleExponentialFilter(); this.filterClippedLegs = true; this.tiltCompensate = true; this.floorOffsetCompensate = false; this.selfIntersectionConstraints = true; this.mirrorView = true; this.boneConstraints = true; this.filterBoneOrientations = true; // For many applications we would enable the // automatic joint smoothing, however, in this // Avateering sample, we perform skeleton joint // position corrections, so we will manually // filter here after these are complete. // Typical smoothing parameters for the joints: var jointPositionSmoothParameters = new TransformSmoothParameters { Smoothing = 0.25f, Correction = 0.25f, Prediction = 0.75f, JitterRadius = 0.1f, MaxDeviationRadius = 0.04f }; this.jointPositionFilter.Init(jointPositionSmoothParameters); // Setup the bone orientation constraint system this.boneOrientationConstraints.AddDefaultConstraints(); game.Components.Add(this.boneOrientationConstraints); // Typical smoothing parameters for the bone orientations: var boneOrientationSmoothparameters = new TransformSmoothParameters { Smoothing = 0.5f, Correction = 0.8f, Prediction = 0.75f, JitterRadius = 0.1f, MaxDeviationRadius = 0.1f }; this.boneOrientationFilter.Init(boneOrientationSmoothparameters); }
/// <summary> /// Initializes a new instance of the AvatarAnimator class. /// </summary> /// <param name="game">The related game object.</param> /// <param name="retarget">The avatar mesh re-targeting method to convert from the Kinect skeleton.</param> public AvatarAnimator(Game game, RetargetMatrixHierarchyToAvatarMesh retarget) : base(game) { if (null == game) { return; } this.retargetMethod = retarget; this.SkeletonDrawn = true; this.useKinectAvateering = true; this.AvatarHipCenterHeight = 0; // Create local axes inside the model to draw at each joint this.localAxes = new CoordinateCross(this.Game, 2f); this.drawLocalAxes = false; game.Components.Add(this.localAxes); // If we draw the Kinect 3D skeleton in BoneOrientationConstraints, we can offset it from the original // hip center position, so as not to draw over the top of the Avatar. Offset defined in m. this.kinectLineSkeletonWorldOffsetMatrix = Matrix.CreateTranslation(40.0f, 0.75f * 40.0f, 0); this.drawBoneConstraintsSkeleton = false; // Skeleton fixups this.frameTimer = new Timer(); this.lastNuiTime = 0; this.FloorClipPlane = new Tuple<float, float, float, float>(0, 0, 0, 0); this.clippedLegs = new SkeletonJointsFilterClippedLegs(); this.sensorOffsetCorrection = new SkeletonJointsSensorOffsetCorrection(); this.jointPositionFilter = new SkeletonJointsPositionDoubleExponentialFilter(); this.boneOrientationConstraints = new BoneOrientationConstraints(game); this.boneOrientationFilter = new BoneOrientationDoubleExponentialFilter(); this.filterClippedLegs = true; this.tiltCompensate = true; this.floorOffsetCompensate = false; this.selfIntersectionConstraints = true; this.mirrorView = true; this.boneConstraints = true; this.filterBoneOrientations = true; // For many applications we would enable the // automatic joint smoothing, however, in this // Avateering sample, we perform skeleton joint // position corrections, so we will manually // filter here after these are complete. // Typical smoothing parameters for the joints: var jointPositionSmoothParameters = new TransformSmoothParameters { Smoothing = 0.25f, Correction = 0.25f, Prediction = 0.75f, JitterRadius = 0.1f, MaxDeviationRadius = 0.04f }; this.jointPositionFilter.Init(jointPositionSmoothParameters); // Setup the bone orientation constraint system this.boneOrientationConstraints.AddDefaultConstraints(); game.Components.Add(this.boneOrientationConstraints); // Typical smoothing parameters for the bone orientations: var boneOrientationSmoothparameters = new TransformSmoothParameters { Smoothing = 0.5f, Correction = 0.8f, Prediction = 0.75f, JitterRadius = 0.1f, MaxDeviationRadius = 0.1f }; this.boneOrientationFilter.Init(boneOrientationSmoothparameters); }