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"

Homing Projectile accuracy

Hello,

I just tried to homing-functionality of the ProjectileMovementComponent and it's working great so far! However, the homing projectiles are really "bad", they always miss the target by a bit, come from the other side, miss again and so on. It looks pretty cool, but I'd like to be able to tune how "accurate" they are ... Shouldn't it be possible to make them better at actually hitting their target? (Altering the Acceleration Magnitude doesn't really help :( )

Thanks for any ideas that you might have :) Regards, Nano

Product Version: Not Selected
Tags:
more ▼

asked Mar 04 '15 at 12:27 AM in Using UE4

avatar image

Nanoxin
311 36 39 44

avatar image SVR33 Mar 24 '15 at 04:59 PM

I'm having this same problem. The main issue seems to be that the homing target is set to the pivot/gizmo location of the targeted component, rather than a hit location/socket/etc, so the projectile is typically 'aiming' for a corner of the mesh and often misses on the first pass [especially when the distance from the gun and target is small and the adjustment angle is large]. I've created some meshes with gizmos placed in the center and this drastically improves the hit ratio but it's still not perfect. On top of that, you can increase the projectile homing acceleration (I think this is what it's called?) value in the projectile BP and this will add an incremental improvement to the 'first pass' hit ratio at the cost of changing the projectile flight path into something less curvy. For what I'm trying to do, though, it needs to be 100% accurate on the first pass and so I'm looking into building my own homing function from scratch. I've avoided it, but don't see a way around it, sadly.

Are you still working through this? Have you found a better solution?

avatar image Nanoxin Mar 24 '15 at 05:16 PM

Hey,

thanks for sharing your investigations, however I have not found a solution to this. At the moment I have those default homing projectiles, but they keep orbiting their targets for an eternity right now, which looks pretty silly when there are more than 4 projectiles at once ...

It's not THAT important for me right now though, so I'm focusing on other things and I keep hoping for someone else to struggle with this/find a solution :/

Your best bet will probably be to write one from scratch though I guess. I hope you find a fitting solution :)

avatar image 0cme Jun 04 '15 at 11:36 AM

Have you tried making the homing acceleration magnitude significantly higher than the max speed? If I have a homing projectile with a max speed of 500 and a homing acceleration magnitude of 50,000 it seems to home in very well, instead of just orbiting around endlessly.

avatar image SVR33 Jun 04 '15 at 09:02 PM

I ultimately ended up using a timeline to lerp up the homing magnitude over time. This way, the projectile fires straight out of the barrel and narrows in more and more over time. This seems to handle all types of shots with a realistic homing arc. Another option would be to scale up the homing magnitude based upon the distance to the target. A bit more computationally intensive, but you could force the projectile to hit the locked target, this way, at the cost of potentially losing a 'realistic' flight path.

avatar image Nanoxin Jun 04 '15 at 09:10 PM

I actually didn't try setting it that high and it makes it more realistic indeed, a medium-high value looks really good for now as I want to save ressources I decided not to compute it with lerps, but I'm glad that it worked for you (SVR33)! :)

Thanks for your tip 0cme :)

Have a nice day!

avatar image Imagine-Games Jun 24 '17 at 06:30 PM

wow. i have been stuck with this one for a couple of days and this just solved it for me...

the issue i was having was :

  1. the homing projectile went to the feet of the enemy mesh, and that wouldnt work for me as I had enemies on roofs while I was on the floor and the projectile would impact with the walls and roof itself before hitting the enemy.

  2. I have my bullets at a certain speed upon construct and setting the homing magnitude to something ridicously high would compromise the aesthetics of the game, having bullets going way too fast...

my solution :

  1. going into my base enemy class and adding a mesh (a cube) not visible, not rendered at all and calling it homing mesh...

  2. the comment by 0cme "Have you tried making the homing acceleration magnitude significantly higher than the max speed? If I have a homing projectile with a max speed of 500 and a homing acceleration magnitude of 50,000 it seems to home in very well, instead of just orbiting around endlessly."

What I was doing was leaving the MAX speed at 0 but that was a big mistake. Actually limiting the max speed to the same value as the initial speed of the bullet (my bullet speed is set on the construction script) and then having the homing projectile magnitude at 50,000 made the bullet hit the target everytime regardless of his height or location in the world (which is essential since I am making a top down shooter with variable terrain heights)....

Also I run a box trace at begin play in the projectile to set the homing target component to be that homing mesh I had set in my enemy base class....

everything works now.. thanks guys, I have searched countless threads looking for an answer but never figured that setting a max speed would be the solution, as I tried and failed with almost every value for the homing magnitude when the max speed was set to 0(no limit)...

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

0 answers: sort voted first
Be the first one to answer this question
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