x

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"

How can I give smooth rotation to a strafing AI?

Currently my AI can enter a strafe state where it circles the player, the issue right now is that the rotation needed to do this is very snappy/glitchy looking. While strafing the AI continuously looks to the player using a rotational timeline, but the AI itself appears to snap back and forth while it strafes. I've tried disabling Orient Rotation to Movement while this happens but it doesn't help at all. The current set up "works" technically speaking but it just doesn't look good at all.

I've tried using RInterp as well but that causes the AI to move in a diamond pattern instead of circling the player. alt text

The best I can describe the issue without video is that the AI will walk sideways looking at the player while strafing, but it will constantly snap to face its movement direction (such as looking forward) for a split second before resuming its normal strafe movement.

Here's how I've got it set up at the moment: alt text

And here is the timeline used: alt text

The movement itself is based on AI Move To using the right and left vectors, if that helps. Am I simply implementing the timeline wrong or would RInterp work and I'm using that wrong too?

Product Version: UE 4.10
Tags:
current_issues.jpg (60.7 kB)
timeline.jpg (67.2 kB)
more ▼

asked Mar 20 '16 at 05:26 AM in Blueprint Scripting

avatar image

Metalbreaker
3 2 4 6

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

1 answer: sort voted first

Quick question...using either method that you currently have does the AI walk around the player as you want (regardless of its rotation that is) does it actually move in the circular direction that you want? If you are able to get the AI to move in the circle you can use a Set Focus node to get AI to look at the player and if you have a blendspace setup for the strafing then this should work as the AI will constantly look at the player...like this:

alt text

This will be used in the AI's BT task

setfocus.png (30.7 kB)
more ▼

answered Mar 20 '16 at 09:01 AM

avatar image

Black Phoenyx
4.1k 165 9 170

avatar image Metalbreaker Mar 20 '16 at 10:50 AM

The way it is currently set up the AI strafes around the player due to its rotation rather than by plotting out a circular pattern for it to follow beforehand. The strafe itself is a AI Move To node that tells it to go using its Location + its right vector * 160 (or whatever float I set it for). Thus as the right or left vector keeps changing as the AI constantly faces the player it creates a circular motion.

Your method above actually made it a lot smoother and clean! I haven't noticed any obvious jittering/snapping behavior. The issue right now is it doesn't seem to constantly face the player, during an attack the AI might be facing to the right or the left of the player as it swings rather than directly towards them. That's weird since the rotation is set in a service on the BT, so it should constantly be updating to face the player. This might be due to my set up more than likely, unless the focus can't be updated each tick.I'm marking your answer as correct if I'm able to get it working right using the Set Focus instead of my old method.

Or would the way I do my strafe not work with what you had in mind?

**edit yes the strafing does use a blendspace.

avatar image Black Phoenyx Mar 20 '16 at 11:01 AM

I've never used it on tick I've always just set it the one time but I don't see why it wouldn't work....the focus should be on the players pawn if you set it to just the player it may be setting its focus on the player controller...I haven't seen your BP tasks so I can't really tell you much more on them...take a closer look at how you are executing an attack to see what might make it offset the focus point

avatar image Metalbreaker Mar 20 '16 at 01:17 PM

After fiddling with it some more this is looking like the direction I should go. It'll take some more work to get everything working just as needed but this is definitely the way to go about it. The stuttering is gone and the AI doesn't snap its rotation when strafing, thanks for the help man!

(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