FeatureSchemaDefault.cpp 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <FeaturePosition.h>
  9. #include <FeatureTrajectory.h>
  10. #include <FeatureVelocity.h>
  11. #include <FeatureSchemaDefault.h>
  12. namespace EMotionFX::MotionMatching
  13. {
  14. void DefaultFeatureSchema(FeatureSchema& featureSchema, DefaultFeatureSchemaInitSettings settings)
  15. {
  16. featureSchema.Clear();
  17. const AZStd::string rootJointName = settings.m_rootJointName;
  18. //----------------------------------------------------------------------------------------------------------
  19. // Past and future root trajectory
  20. FeatureTrajectory* rootTrajectory = aznew FeatureTrajectory();
  21. rootTrajectory->SetJointName(rootJointName);
  22. rootTrajectory->SetRelativeToJointName(rootJointName);
  23. rootTrajectory->SetDebugDrawColor(AZ::Color::CreateFromRgba(157,78,221,255));
  24. rootTrajectory->SetDebugDrawEnabled(true);
  25. featureSchema.AddFeature(rootTrajectory);
  26. //----------------------------------------------------------------------------------------------------------
  27. // Left foot position
  28. FeaturePosition* leftFootPosition = aznew FeaturePosition();
  29. leftFootPosition->SetName("Left Foot Position");
  30. leftFootPosition->SetJointName(settings.m_leftFootJointName);
  31. leftFootPosition->SetRelativeToJointName(rootJointName);
  32. leftFootPosition->SetDebugDrawColor(AZ::Color::CreateFromRgba(255,173,173,255));
  33. leftFootPosition->SetDebugDrawEnabled(true);
  34. featureSchema.AddFeature(leftFootPosition);
  35. //----------------------------------------------------------------------------------------------------------
  36. // Right foot position
  37. FeaturePosition* rightFootPosition = aznew FeaturePosition();
  38. rightFootPosition->SetName("Right Foot Position");
  39. rightFootPosition->SetJointName(settings.m_rightFootJointName);
  40. rightFootPosition->SetRelativeToJointName(rootJointName);
  41. rightFootPosition->SetDebugDrawColor(AZ::Color::CreateFromRgba(253,255,182,255));
  42. rightFootPosition->SetDebugDrawEnabled(true);
  43. featureSchema.AddFeature(rightFootPosition);
  44. //----------------------------------------------------------------------------------------------------------
  45. // Left foot velocity
  46. FeatureVelocity* leftFootVelocity = aznew FeatureVelocity();
  47. leftFootVelocity->SetName("Left Foot Velocity");
  48. leftFootVelocity->SetJointName(settings.m_leftFootJointName);
  49. leftFootVelocity->SetRelativeToJointName(rootJointName);
  50. leftFootVelocity->SetDebugDrawColor(AZ::Color::CreateFromRgba(155,246,255,255));
  51. leftFootVelocity->SetDebugDrawEnabled(true);
  52. leftFootVelocity->SetCostFactor(0.75f);
  53. featureSchema.AddFeature(leftFootVelocity);
  54. //----------------------------------------------------------------------------------------------------------
  55. // Right foot velocity
  56. FeatureVelocity* rightFootVelocity = aznew FeatureVelocity();
  57. rightFootVelocity->SetName("Right Foot Velocity");
  58. rightFootVelocity->SetJointName(settings.m_rightFootJointName);
  59. rightFootVelocity->SetRelativeToJointName(rootJointName);
  60. rightFootVelocity->SetDebugDrawColor(AZ::Color::CreateFromRgba(189,178,255,255));
  61. rightFootVelocity->SetDebugDrawEnabled(true);
  62. rightFootVelocity->SetCostFactor(0.75f);
  63. featureSchema.AddFeature(rightFootVelocity);
  64. //----------------------------------------------------------------------------------------------------------
  65. // Pelvis velocity
  66. FeatureVelocity* pelvisVelocity = aznew FeatureVelocity();
  67. pelvisVelocity->SetName("Pelvis Velocity");
  68. pelvisVelocity->SetJointName(settings.m_pelvisJointName);
  69. pelvisVelocity->SetRelativeToJointName(rootJointName);
  70. pelvisVelocity->SetDebugDrawColor(AZ::Color::CreateFromRgba(185,255,175,255));
  71. pelvisVelocity->SetDebugDrawEnabled(true);
  72. featureSchema.AddFeature(pelvisVelocity);
  73. }
  74. } // namespace EMotionFX::MotionMatching