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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to add randomness in homing projectile.

Hello. I have setup a system where enemy shoots a projectile to the player. I am using blueprint and setting the current player homing component of the enemy projectile. The issue is the enemy is shooting accurately every time to the player how can i add some randomness or missing feature to homing projectile?

Product Version: UE 4.14
Tags:
more ▼

asked May 24 '18 at 03:50 PM in Blueprint Scripting

avatar image

acetate
28 2 9 6

avatar image ThompsonN13 May 24 '18 at 04:13 PM

arent homing projectiles designed for the purpose of not missing? hence the homing bit haha. but yea without looking to deep into it you would need to create a target for the projectile to move to that is close to the target character. or you could do what some games have done in the past and have a timer on the projectile that makes it explode if it hasnt hit a target in so long, this would give the other characters a chance to run. this is all very dependent on your game though and isnt something ive attempted to do before.

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

1 answer: sort voted first

You can make a "dumb" homing missile by having it store the player's current location as a vector variable when the projectile is first spawned, and it homes in on THAT location. If it requires an Actor to home toward, you can create a bare bones base Actor and spawn it at the player's current location.

Then the missile will home in, but only toward where the player USED to be if the player moves.

Option 2 is a smarter homing missile but you create a random offset range away from the player so that sometimes it is trying to home in on a spot that's not exactly where the player is, but near it.

Option 3 you could create a base actor to use as the homing target like in option 1, BUT the base actor is always lerping toward the player's actual position, with a delay. That way the more evasive maneuvers the player makes, the further the target point will be from leading the missile to the player;s actual position.

Another option is you can simply adjust the homing acceleration on the projectilemovement component of the missile so that it can't turn fast enough to catch up with the target's evasions.

That last one is probably the easiest way to do it, if your missile uses the projectilemovement component.

more ▼

answered May 24 '18 at 06:49 PM

avatar image

mightyenigma
3.8k 18 20 20

(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