When AI enters a specific collision, I want to rotate it in a specific direction and play a montage.
If SetActorRotation and PlayMontage are executed when collision overlaps, the montage is executed without rotating in the desired direction.
This is probably because AI MoveTo is activated, the SetActorRotation value is valid for only 1 tick, and the Rotation value by AIMoveTo is output again.
so it seems like AI does not rotate in the desired direction even if excuting function,
AIController::StopMovement or MovementComponent::StopMovementImmidiately before SetActorRotation.
How can I stop using MoveTo and use SetActorRotation as soon as the AI using MoveTo overlaps the collision?
Use SetFocus to tell the AI to look at something while moving.
Make sure the AI also has strafing enabled.
Thanks for the reply
However, using SetFocus is difficult because there is nothing to look at in the direction I want the AI to rotate.
The function I want to create now is that when a horse runs towards the AI and the collision in front of the horse overlaps, AI rotates to the left and right of the horse and then excute montage that jump forward.
It is difficult to assign an Actor to SetFocus because it is not possible to specify something that is always visible on the left and right sides of the horse.
You can use SetFocalPoint to specify a custom world position instead of focusing on an Actor.
// left
SetFocalPoint(Horse->GetActorLocation() - 500*Horse->GetActorRightVector());
// right
SetFocalPoint(Horse->GetActorLocation() + 500*Horse->GetActorRightVector());
Perhaps MoveTo function goes into an infinite loop and the function you mentioned is ignored. Thank you for showing me the new method. I will try to solve it this way. Thanks again!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.