Add bAutoManageListening to InteractionComponent
Automatically calls StartListening/StopListening on the agent's ElevenLabsComponent on selection/deselection. Enabled by default. Disable for manual control (e.g. push-to-talk). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6c081e1207
commit
23e216b211
@ -66,7 +66,11 @@ void UPS_AI_ConvAgent_InteractionComponent::EndPlay(const EEndPlayReason::Type E
|
|||||||
// Fire deselection event for cleanup.
|
// Fire deselection event for cleanup.
|
||||||
if (UPS_AI_ConvAgent_ElevenLabsComponent* Agent = SelectedAgent.Get())
|
if (UPS_AI_ConvAgent_ElevenLabsComponent* Agent = SelectedAgent.Get())
|
||||||
{
|
{
|
||||||
// Clear posture immediately on shutdown — no delay.
|
// Stop listening and clear posture immediately on shutdown — no delay.
|
||||||
|
if (bAutoManageListening)
|
||||||
|
{
|
||||||
|
Agent->StopListening();
|
||||||
|
}
|
||||||
if (bAutoManagePosture)
|
if (bAutoManagePosture)
|
||||||
{
|
{
|
||||||
DetachPostureTarget(Agent);
|
DetachPostureTarget(Agent);
|
||||||
@ -190,6 +194,12 @@ void UPS_AI_ConvAgent_InteractionComponent::SetSelectedAgent(UPS_AI_ConvAgent_El
|
|||||||
OldAgent->GetOwner() ? *OldAgent->GetOwner()->GetName() : TEXT("(null)"));
|
OldAgent->GetOwner() ? *OldAgent->GetOwner()->GetName() : TEXT("(null)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Listening: stop ──────────────────────────────────────────────
|
||||||
|
if (bAutoManageListening)
|
||||||
|
{
|
||||||
|
OldAgent->StopListening();
|
||||||
|
}
|
||||||
|
|
||||||
// ── Posture: detach ──────────────────────────────────────────────
|
// ── Posture: detach ──────────────────────────────────────────────
|
||||||
if (bAutoManagePosture && World)
|
if (bAutoManagePosture && World)
|
||||||
{
|
{
|
||||||
@ -230,6 +240,12 @@ void UPS_AI_ConvAgent_InteractionComponent::SetSelectedAgent(UPS_AI_ConvAgent_El
|
|||||||
MicComponent->StartCapture();
|
MicComponent->StartCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Listening: start ─────────────────────────────────────────────
|
||||||
|
if (bAutoManageListening)
|
||||||
|
{
|
||||||
|
NewAgent->StartListening();
|
||||||
|
}
|
||||||
|
|
||||||
// ── Posture: attach ──────────────────────────────────────────────
|
// ── Posture: attach ──────────────────────────────────────────────
|
||||||
if (bAutoManagePosture && World)
|
if (bAutoManagePosture && World)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -114,6 +114,15 @@ public:
|
|||||||
ToolTip = "Seconds to wait before the agent stops looking at the pawn.\n0 = immediate."))
|
ToolTip = "Seconds to wait before the agent stops looking at the pawn.\n0 = immediate."))
|
||||||
float PostureDetachDelay = 0.0f;
|
float PostureDetachDelay = 0.0f;
|
||||||
|
|
||||||
|
// ── Listening management ─────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/** Automatically call StartListening/StopListening on the agent's
|
||||||
|
* ElevenLabsComponent when selected/deselected. When false, listening
|
||||||
|
* must be managed from Blueprint. */
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PS AI ConvAgent|Interaction|Listening",
|
||||||
|
meta = (ToolTip = "Automatically open/close the agent's mic turn on selection.\nDisable for manual control (e.g. push-to-talk)."))
|
||||||
|
bool bAutoManageListening = true;
|
||||||
|
|
||||||
// ── Debug ────────────────────────────────────────────────────────────────
|
// ── Debug ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
/** Enable debug logging for this component. */
|
/** Enable debug logging for this component. */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user