Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AI SetFocus Instantly snap rotate to location (How to make it rotate smoothly?)

When I Set New Focus, the AI Instantly snap rotate to the focused location.... Any Idea how to make it smoothly rotate to the new focused location?

Thank you in advance.

Product Version: UE 4.21
more ▼

asked May 19 '19 at 12:33 PM in Everything Else

avatar image

6 5 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

There is no built-in smooth rotation (not in the same way as SetFocus is working), but it's not complex to implement:

  • Instead of Set Focus, just save the target location in a variable

  • In a tick, calculate the desired rotation from your location and target location

  • use the RInterpTo node for smooth rotation

Here is the good video about how to use this node: https://www.youtube.com/watch?v=yoKJMhgSxmU

more ▼

answered May 19 '19 at 03:09 PM

avatar image

435 11 18 25

avatar image dinasorZ May 20 '19 at 06:56 AM

The problem of not using SetFocus is that (And maybe I'm wrong, except for the last reason which I've tested a lot):

  • It's not heavy on the system as RInterpTo that runs every tick.

  • It have better syncing with multiplayer as it's independent from frame tick.

  • With SetFocus AI's pawn always face the target while it's moving, which uses the Movement Blendspace Animations that is based on Direction in the right way. Ex: with SetFocus AI will face player and move backward normally with the right backward animation, while with RInterp the AI will always play "forward" animation even if it's moving backward

I'm thinking though of using RInterpTo/Ease before setting a new focus as a workaround, so for example when player shoot AI from behind the AI will first RInterp smoothly to player over Timeline, then after Timeline finishes I'll set the new focus... I'm open for suggestions though if there is a better solution :)

avatar image norlin May 20 '19 at 07:06 AM

SetFocus is also use per-tick updates for tracking. Though not sure about network solution, it still should work with manual rotation.

You can use SetFocus along with lerping target location if you want to (just update the focus per tick), but probably it will be heavier than setting manual rotation.

Another workaround is to make an invisible Actor for targeting, call SetFocus to this actor just once, and update it's location smoothly as you want to.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question