فهرست منبع

apple animation

Signed-off-by: Adam Dabrowski <[email protected]>

Co-authored-by: shawstar [email protected]
Adam Dabrowski 2 سال پیش
والد
کامیت
f73b7a921e

+ 3 - 0
Project/Assets/Animations/AppleAnime.fbx

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:029346bfbb01ef0cded04565deeb72ec04975e16ad97f2414f95019e3bd9bb10
+size 111324

+ 107 - 44
Project/Assets/Importer/apple_kraken_5.prefab

@@ -275,7 +275,8 @@
                                         "MaterialAsset": {
                                         "MaterialAsset": {
                                             "assetId": {
                                             "assetId": {
                                                 "guid": "{A5320FCC-06A5-570B-8737-35357E223030}"
                                                 "guid": "{A5320FCC-06A5-570B-8737-35357E223030}"
-                                            }
+                                            },
+                                            "assetHint": "assets/robotec_freezed_urdf_chasis/meshes/chassisandframe/chassisandframe_pipe.azmaterial"
                                         }
                                         }
                                     }
                                     }
                                 }
                                 }
@@ -2457,8 +2458,7 @@
                             "assetHint": "prefabs/apple_crate.spawnable"
                             "assetHint": "prefabs/apple_crate.spawnable"
                         },
                         },
                         "Capacity": 50,
                         "Capacity": 50,
-                        "CrateDropPoint": "Entity_[5494828217205]",
-                        "UiEntity": "Entity_[5286907825968]"
+                        "CrateDropPoint": "Entity_[5494828217205]"
                     }
                     }
                 },
                 },
                 "Component_[12724369969007930765]": {
                 "Component_[12724369969007930765]": {
@@ -2480,7 +2480,8 @@
                         "$type": "ApplePickerComponent",
                         "$type": "ApplePickerComponent",
                         "EffectorEntity": "Entity_[126373983206044]",
                         "EffectorEntity": "Entity_[126373983206044]",
                         "FruitStorageEntity": "Entity_[126373983206044]",
                         "FruitStorageEntity": "Entity_[126373983206044]",
-                        "RetrievalPointEntity": "Entity_[453828565735265]"
+                        "RetrievalPointEntity": "Entity_[453828565735265]",
+                        "AppleEntryAnimationEntity": "Entity_[5359642877688]"
                     }
                     }
                 },
                 },
                 "Component_[15792714784584127302]": {
                 "Component_[15792714784584127302]": {
@@ -3568,7 +3569,10 @@
                 },
                 },
                 "Component_[12999122222194170561]": {
                 "Component_[12999122222194170561]": {
                     "$type": "EditorEntitySortComponent",
                     "$type": "EditorEntitySortComponent",
-                    "Id": 12999122222194170561
+                    "Id": 12999122222194170561,
+                    "Child Entity Order": [
+                        "Entity_[5359642877688]"
+                    ]
                 },
                 },
                 "Component_[13504040141164984746]": {
                 "Component_[13504040141164984746]": {
                     "$type": "EditorEntityIconComponent",
                     "$type": "EditorEntityIconComponent",
@@ -3764,57 +3768,116 @@
                 }
                 }
             }
             }
         },
         },
-        "Entity_[5286907825968]": {
-            "Id": "Entity_[5286907825968]",
-            "Name": "Ui",
+        "Entity_[5359642877688]": {
+            "Id": "Entity_[5359642877688]",
+            "Name": "ChuteAnimation",
             "Components": {
             "Components": {
-                "Component_[10241251369859239566]": {
+                "Component_[1291718221619230642]": {
+                    "$type": "EditorEntityIconComponent",
+                    "Id": 1291718221619230642
+                },
+                "Component_[12917291486169062442]": {
+                    "$type": "EditorVisibilityComponent",
+                    "Id": 12917291486169062442
+                },
+                "Component_[13952856694950286421]": {
+                    "$type": "EditorActorComponent",
+                    "Id": 13952856694950286421,
+                    "ActorAsset": {
+                        "assetId": {
+                            "guid": "{3A5DC656-3A4A-5CF1-B390-1B0FD5635DD9}",
+                            "subId": 4135515199
+                        },
+                        "loadBehavior": "QueueLoad",
+                        "assetHint": "assets/animations/appleanime.actor"
+                    },
+                    "MaterialPerLOD": [
+                        {}
+                    ],
+                    "AttachmentTarget": ""
+                },
+                "Component_[14748218583400846268]": {
+                    "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
+                    "Id": 14748218583400846268,
+                    "Parent Entity": "Entity_[453828565735265]",
+                    "Transform Data": {
+                        "Translate": [
+                            0.0,
+                            0.10000000149011612,
+                            0.0
+                        ],
+                        "Rotate": [
+                            -10.0,
+                            0.0,
+                            -90.0
+                        ]
+                    }
+                },
+                "Component_[14870525916692050186]": {
                     "$type": "EditorEntitySortComponent",
                     "$type": "EditorEntitySortComponent",
-                    "Id": 10241251369859239566
+                    "Id": 14870525916692050186
                 },
                 },
-                "Component_[11465251640864354376]": {
+                "Component_[15668233960636941169]": {
                     "$type": "EditorLockComponent",
                     "$type": "EditorLockComponent",
-                    "Id": 11465251640864354376
-                },
-                "Component_[12565340982288084460]": {
-                    "$type": "EditorInspectorComponent",
-                    "Id": 12565340982288084460
+                    "Id": 15668233960636941169
                 },
                 },
-                "Component_[12663538255353574993]": {
-                    "$type": "EditorEntityIconComponent",
-                    "Id": 12663538255353574993
+                "Component_[16639282969695111833]": {
+                    "$type": "EditorDisabledCompositionComponent",
+                    "Id": 16639282969695111833
                 },
                 },
-                "Component_[15097666237341457527]": {
+                "Component_[17735886932956230014]": {
                     "$type": "EditorOnlyEntityComponent",
                     "$type": "EditorOnlyEntityComponent",
-                    "Id": 15097666237341457527
+                    "Id": 17735886932956230014
                 },
                 },
-                "Component_[15799199674941686217]": {
-                    "$type": "GenericComponentWrapper",
-                    "Id": 15799199674941686217,
-                    "m_template": {
-                        "$type": "UiCanvasAssetRefComponent",
-                        "CanvasAssetRef": {
-                            "AssetPath": "ui/gamecanvas.uicanvas"
+                "Component_[255154858065024891]": {
+                    "$type": "EditorPendingCompositionComponent",
+                    "Id": 255154858065024891
+                },
+                "Component_[3947071864839309671]": {
+                    "$type": "EditorSimpleMotionComponent",
+                    "Id": 3947071864839309671,
+                    "PreviewInEditor": true,
+                    "Configuration": {
+                        "MotionAsset": {
+                            "assetId": {
+                                "guid": "{3A5DC656-3A4A-5CF1-B390-1B0FD5635DD9}",
+                                "subId": 2521389219
+                            },
+                            "assetHint": "assets/animations/appleanime.motion"
                         },
                         },
-                        "IsAutoLoad": true
+                        "Reverse": true,
+                        "PlaySpeed": 4.0,
+                        "PlayOnActivation": false,
+                        "FreezeAtLastFrame": false
                     }
                     }
                 },
                 },
-                "Component_[18129706037953483051]": {
-                    "$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
-                    "Id": 18129706037953483051,
-                    "Parent Entity": "Entity_[126373983206044]"
-                },
-                "Component_[4946259882969052376]": {
-                    "$type": "EditorPendingCompositionComponent",
-                    "Id": 4946259882969052376
-                },
-                "Component_[5951762884545543629]": {
-                    "$type": "EditorVisibilityComponent",
-                    "Id": 5951762884545543629
+                "Component_[4349866872489799165]": {
+                    "$type": "EditorMaterialComponent",
+                    "Id": 4349866872489799165,
+                    "Controller": {
+                        "Configuration": {
+                            "materials": [
+                                {
+                                    "Key": {
+                                        "materialSlotStableId": 4137209423
+                                    },
+                                    "Value": {
+                                        "MaterialAsset": {
+                                            "assetId": {
+                                                "guid": "{55097FFC-EE11-5B2D-9E83-1ECE5FCA4341}",
+                                                "subId": 1676432290
+                                            },
+                                            "assetHint": "assets/apple_tree/apple_applemat_16773115630758679458.azmaterial"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
                 },
                 },
-                "Component_[9445786852124677420]": {
-                    "$type": "EditorDisabledCompositionComponent",
-                    "Id": 9445786852124677420
+                "Component_[8809330154460966515]": {
+                    "$type": "EditorInspectorComponent",
+                    "Id": 8809330154460966515
                 }
                 }
             }
             }
         },
         },

+ 1 - 0
Project/Gem/CMakeLists.txt

@@ -44,6 +44,7 @@ ly_add_target(
         PRIVATE
         PRIVATE
             AZ::AzGameFramework
             AZ::AzGameFramework
             AZ::AzFramework
             AZ::AzFramework
+            Gem::EMotionFX.Static
             Gem::LmbrCentral.API
             Gem::LmbrCentral.API
             Gem::LyShine
             Gem::LyShine
             Gem::AtomLyIntegration_CommonFeatures.Editor.Static
             Gem::AtomLyIntegration_CommonFeatures.Editor.Static

+ 21 - 3
Project/Gem/Source/ApplePicker/ApplePickerComponent.cpp

@@ -19,6 +19,7 @@
 #include <AzCore/Serialization/EditContextConstants.inl>
 #include <AzCore/Serialization/EditContextConstants.inl>
 #include <AzFramework/Physics/PhysicsSystem.h>
 #include <AzFramework/Physics/PhysicsSystem.h>
 #include <AzFramework/Physics/Shape.h>
 #include <AzFramework/Physics/Shape.h>
+#include <Integration/SimpleMotionComponentBus.h>
 #include <ROS2/Frame/ROS2FrameComponent.h>
 #include <ROS2/Frame/ROS2FrameComponent.h>
 #include <ROS2/ROS2Bus.h>
 #include <ROS2/ROS2Bus.h>
 #include <ROS2/Utilities/ROS2Names.h>
 #include <ROS2/Utilities/ROS2Names.h>
@@ -193,7 +194,8 @@ namespace AppleKraken
                 ->Field("CancelServiceTopic", &ApplePickerComponent::m_cancelServiceTopic)
                 ->Field("CancelServiceTopic", &ApplePickerComponent::m_cancelServiceTopic)
                 ->Field("EffectorEntity", &ApplePickerComponent::m_effectorEntityId)
                 ->Field("EffectorEntity", &ApplePickerComponent::m_effectorEntityId)
                 ->Field("FruitStorageEntity", &ApplePickerComponent::m_fruitStorageEntityId)
                 ->Field("FruitStorageEntity", &ApplePickerComponent::m_fruitStorageEntityId)
-                ->Field("RetrievalPointEntity", &ApplePickerComponent::m_retrievalPointEntityId);
+                ->Field("RetrievalPointEntity", &ApplePickerComponent::m_retrievalPointEntityId)
+                ->Field("AppleEntryAnimationEntity", &ApplePickerComponent::m_entryAnimationEntityId);
 
 
             if (AZ::EditContext* ec = serialize->GetEditContext())
             if (AZ::EditContext* ec = serialize->GetEditContext())
             {
             {
@@ -224,8 +226,13 @@ namespace AppleKraken
                     ->DataElement(
                     ->DataElement(
                         AZ::Edit::UIHandlers::EntityId,
                         AZ::Edit::UIHandlers::EntityId,
                         &ApplePickerComponent::m_retrievalPointEntityId,
                         &ApplePickerComponent::m_retrievalPointEntityId,
-                        "Fruit retrieval point",
-                        "Entity which holds the point of the retrieval chute");
+                        "Retrieval point",
+                        "Entity which holds the point of the apple retrieval chute")
+                    ->DataElement(
+                        AZ::Edit::UIHandlers::EntityId,
+                        &ApplePickerComponent::m_entryAnimationEntityId,
+                        "Animation point",
+                        "Entity which holds the point of apple entry to chute for animation");
             }
             }
         }
         }
     }
     }
@@ -274,6 +281,17 @@ namespace AppleKraken
         Tags applePickingEventTags = { kPickingAutomatedEventTag };
         Tags applePickingEventTags = { kPickingAutomatedEventTag };
         FruitStorageRequestsBus::Event(m_fruitStorageEntityId, &FruitStorageRequests::AddApple, applePickingEventTags);
         FruitStorageRequestsBus::Event(m_fruitStorageEntityId, &FruitStorageRequests::AddApple, applePickingEventTags);
         DemoStatisticsNotificationBus::Broadcast(&DemoStatisticsNotifications::AddApple, applePickingEventTags);
         DemoStatisticsNotificationBus::Broadcast(&DemoStatisticsNotifications::AddApple, applePickingEventTags);
+
+        if (!m_entryAnimationEntityId.IsValid())
+        {
+            AZ_Warning("ApplePicker", false, "No animation for apple entry will be played since entry animation entity is invalid");
+        }
+        else
+        {
+            EMotionFX::Integration::SimpleMotionComponentRequestBus::Event(
+                m_entryAnimationEntityId, &EMotionFX::Integration::SimpleMotionComponentRequestBus::Events::PlayMotion);
+        }
+
         PickNextApple();
         PickNextApple();
     }
     }
 
 

+ 1 - 0
Project/Gem/Source/ApplePicker/ApplePickerComponent.h

@@ -64,6 +64,7 @@ namespace AppleKraken
 
 
         // TODO - actually use this entity for retrieval position
         // TODO - actually use this entity for retrieval position
         AZ::EntityId m_retrievalPointEntityId; //!< used to sort apples by distance to retrieval chute
         AZ::EntityId m_retrievalPointEntityId; //!< used to sort apples by distance to retrieval chute
+        AZ::EntityId m_entryAnimationEntityId; //!< used to animate apple going into chute
 
 
         rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr m_triggerService;
         rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr m_triggerService;
         rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr m_cancelService;
         rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr m_cancelService;