Gems/EMotionFX/Code/Source/Integration/Components/ActorComponent.cpp
void ActorComponent::OnDetached(AZ::EntityId targetId)
        {
            // Remove the targetId from the attachment list
            const AZ::EntityId* busIdPtr = LmbrCentral::AttachmentComponentNotificationBus::GetCurrentBusId();
            if (busIdPtr)
            {
                m_attachments.erase(AZStd::remove(m_attachments.begin(), m_attachments.end(), targetId), m_attachments.end());
            }

            if (!m_actorInstance)
            {
                return;
            }

            ActorInstance* targetActorInstance = nullptr;
            ActorComponentRequestBus::EventResult(targetActorInstance, targetId, &ActorComponentRequestBus::Events::GetActorInstance);
            if (targetActorInstance)
            {
                m_actorInstance->RemoveAttachment(targetActorInstance);
            }
        }
// The entity is detaching from the target.
The entity is detaching from the target.
The entity is detaching from the target .
void ActorComponent::OnDetached(AZ::EntityId targetId)
        {
            const AZ::EntityId* busIdPtr = LmbrCentral::AttachmentComponentNotificationBus::GetCurrentBusId();
            if (busIdPtr)
            {
                m_attachments.erase(AZStd::remove(m_attachments.begin(), m_attachments.end(), targetId), m_attachments.end());
            }
            if (!m_actorInstance)
            {
                return;
            }
            ActorInstance* targetActorInstance = nullptr;
            ActorComponentRequestBus::EventResult(targetActorInstance, targetId, &ActorComponentRequestBus::Events::GetActorInstance);
            if (targetActorInstance)
            {
                m_actorInstance->RemoveAttachment(targetActorInstance);
            }
        }
void ActorComponent :: OnDetached ( AZ :: EntityId targetId ) { const AZ :: EntityId * busIdPtr = LmbrCentral :: AttachmentComponentNotificationBus :: GetCurrentBusId ( ) ; if ( busIdPtr ) { m_attachments . erase ( AZStd :: remove ( m_attachments . begin ( ) , m_attachments . end ( ) , targetId ) , m_attachments . end ( ) ) ; } if ( ! m_actorInstance ) { return ; } ActorInstance * targetActorInstance = nullptr ; ActorComponentRequestBus :: EventResult ( targetActorInstance , targetId , & ActorComponentRequestBus :: Events :: GetActorInstance ) ; if ( targetActorInstance ) { m_actorInstance -> RemoveAttachment ( targetActorInstance ) ; } }
The entity is detaching from the target.
The entity is detaching from the target .
// Remove the targetId from the attachment list