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 to calculate bullet's fly trajectory?

I really would like to teach bot to fire at long distances. Do anybody know how to calculate or/and draw bullet's trajectory (bullet has default physics).

Product Version: UE 4.20
Tags:
more ▼

asked Jul 11 '18 at 08:30 AM in Blueprint Scripting

avatar image

RenegadeCash436
1 1 2

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

2 answers: sort voted first

You can use a spline mesh component that will reduce the height of each point as they get further from the player, based on a bullet drop strength you can define.

You can also use this spline to move a bullet-sized colliding actor along the spline to determine where a blocking hit will occur. Similar to a line-trace, but arcing. This also allows you to draw something along the spline to show where the bullet will travel before you fire (assuming nothing gets in the way between the time the bullet is fired and it reaches its target). This draw can be scaled between the AI and the colliding location determined by the spline collision check.

EDIT: I am advocating that you move the bullet along the predetermined spline, rather than rely on physics/gravity to bring the bullet down, purely for accuracy of determination.

more ▼

answered Jul 11 '18 at 09:38 AM

avatar image

Unfathomable
169 2 2 5

avatar image RenegadeCash436 Jul 14 '18 at 10:44 AM

Can you describe your method more detailed? I'm beginner in using unreal engine, so I can not sort out splines on my own. Also english is not my primary language. Thank you very much!!!

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

Hey @RenegadeCash436, I think I have a tutorial that will help you figure most of this out. You probably will need to modify some stuff for your particular purposes not sure what you mean exactly by "teach a bot to fire at long distance" but this tutorial will show you how to use physics trajectories to create an arched path for a projectile, how to add a tracer to that path to show where it will land and there is an extra tutorial showing you how to draw out the arc path if you desire. I have linked you to the first video. Hope this helps.

https://youtu.be/LFAxAvBCYII

more ▼

answered Jul 11 '18 at 10:32 PM

avatar image

Nebula Games Inc
2.7k 14 8 8

avatar image RenegadeCash436 Jul 14 '18 at 10:45 AM

Thanks, my problem now is partly solved! But the idea is another. Do you know WoWs or WarThunder? I want my bot to be as wise as those games bots. It can already turn to me in any direction and predict my move, BUT bullet falls down because of gravity.

avatar image Nebula Games Inc Aug 22 '18 at 03:31 AM

No not familiar with those games sorry. But what exactly are you trying to achieve? “Smart bots” is a little more complicated than simply predicting a bullets path. That is getting into AI

avatar image RenegadeCash436 Aug 22 '18 at 10:50 AM

I want my bots to consider ballistics of bullet. For example, there is a plane, who flies on 10000 height and AA gun, which sees it. AA gun calculates place, where will be plane, when bullet will fly to the plane( bullets speed* distance to plane). and miss, because bullet falls down 'cause of gravity. I want gun to consider this ballistic. If you played WoWs, than you know, that player just select place he wants shells to drop, but computer calculates firing angle on it's own, taking care of damping, distance and shell's speed.
the only thing player must do - think about time, which shell needs to fly to target. Hope You got it!!!

avatar image Nebula Games Inc Aug 22 '18 at 05:13 PM

There is a BP node called "predict projectile path" or something similar. You might want to look into that, you would just have to tie that in with some functionality to also predict enemy movement before firing.

avatar image RenegadeCash436 Aug 24 '18 at 07:53 AM

maybe, but how will I calculate the Tower's Pitch?

avatar image RenegadeCash436 Aug 26 '18 at 11:30 AM

It doesn't help, or I am stupid:)

avatar image Nebula Games Inc Aug 26 '18 at 12:24 PM

What do you have so far? It is hard to help further if the basic nodes aren't working without screen shots of your set up and a more detailed explanation of the effect you are achieving. I think I get the effect you WANT but I don't know what the issue is or how to help because all you tell me is "it doesn't qork". What doesn't work? What part specifically? The bullet flies in an arc but it's the wrong arc? The bullet over or under shoots the target? Etc etc

(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