Initial Speed based on distance ?

I’m extremely poor at maths since I left school 20 years ago.

Trying to work out the initial speed (projectile m) based on the distance ? (fixed angle of 45)

Then use google, it has links to wiki pages that have all formulas. Hint: word you need to feed for google is “ballistic formula”.

Or you can use “projectile movement component”, unreal has it ready.

I’m using the Projectile Movement component, but has what ?

Looking at the formulas just makes thinking worse, none of it makes sense anymore, that’s why I posted this.

Not getting any better, can’t find how to do it without knowing time.

So how we should tell you about formulas (that are very simple ones) if you cannot watch formulas?

Well i try to explain anyway:
I assume there is no air drag for your projectile, we shooting it in vacuum. Split motion of your bullet into 2 separate motions: one is horizontal with constant speed, second is exactly vertical (it goes up then down and hits same spot it started from). Both parts of motion take exactly same time.

But cannot get further without formulas.

distance = (v*v/g)sin(2angle)

so vv=(distanceg)/sin(2*angle)

because angle = 45 then 2*angle = 90
and sin(90)=1

vv=(distanceg)

and your velocity:

V = sqrt(distance*g)

Now this is actually quite good way for checking how accurate is physics in unreal.

Ps. Learn (refresh) math or vectors will make you go nuts. And you need vectors for about any type of game.

Thinking parametrically may help. With no air resistance, the horizontal velocity will not change. The verticle velocity does. If x is the horizontal component and y is the verticle component:
x (horz. vel.) = some constant
y (vert. vel.) = gravity*time + initial velocity.

Thanks so much for the lame description, just what I need.

Not sure if it is me or not but, to get the velocity as mentioned I added the distance * gravity -980 (default setting) as positive 980 then Sqrt., but had to -50 to get it to match.

Hey i have a question, so i have zero background in unreal engine and Ive been trying to grasp onto some of the basics for it but its taking forever, could you perhaps tell me about the main points if i was to do and environment where i want to explain the projectile motion for students (2 scenarios) one is where they input the angle and one where they input the initial velocity, is that easy to do? If so , could you tell me what are the main steps?

You probably want to make some projectile trajectory plotting.
So you need for it:

  • background or some decorations like funny village or just Cartesian grid, for that get one of free assets from marketplace or build level yourself
  • actor that will calculate trajectory, add some components on it (like static mesh components or particle effects etc)
  • function that given velocity vector will calculate all points (transforms) along path
  • interface for setting parameters: like direction, speed, angles, mass of projectile, etc

I made that project (morning coffe time):

It is barebone, but you have starting point, was raiser to do than to really explain it all here.
all things you need are in content/ folder

1 Like

Thank you!!!

Could you perhaps record me a video for all this? Im so confused even the assts wont add to the shoot project you made🥲

Oh i made that project because it was easier than explaining it all. :smiley:

What all blueprints are for:

  • My_GameMode - this is only to set up pawn properly
  • My_HUD - hmm, this does nothing, i wanted to spawn hud there, but i did it in pawn
  • My_Pawn - this is just camera, and spawning HUD

Now two important ones (that do something):

  • MY_UMG_Widget - this is that ui box in lower left corner, it has two text entry boxes where you can put angle and speed, when you press enter it finds MY_PlottingActor, and tells it speed or angle was changed
  • My_PlottingActor - this is where most of stuff happens

Now about My_PlottingActor:

  • it has event_fire, this is what makes dots
  • first it removes old dots/mesh components
  • then it updates time (time+delta_time)
  • then it calculates VX and VY increments from formula for bullet without air drag
  • last it spawns all dots/meshes

Spawning meshes:

  • you have dot_mesh variable - set your mesh there
  • and Mesh_Inst_Material - set material INSTANCE there to make colors etc.

Materials:

  • MyRedMaterial - this is base material to create instanced material from
  • My_Material_Inst - this is instance you can edit color and glow/emmisive strength of it.

I feel like what your saying makes sense to you but im literally a noob (beginner) when it comes to ue5 , i tried watching many videos and they all explain the same stuff which i don’t really get. I found a video on yt showing the exact same environment im trying to create and if yk anyone or perhaps you if you had the time could help , u can give me their contact social pls its important
This is the yt video: https://youtu.be/7odC1tdkUOQ?si=ae_ZjtqDCoRQM0qV

My barebone project is almost there. You need to use another pawn as base. Then modify Shoot actor so it shoots on begin play with new velocity and angle values.

However interacting in 3d with objects like that hammer or cannot requires more coding.

And because you are saying that you are total noob in ue5, i do not know how i could help really, (besides making whole project).

I’m still trying to figure out the project, and I genuinely don’t understand anything in it and i feel hopeless, could you perhaps help me with the cannon?

I can see all the equations you did, and these are really good!! If you could walk me through the cannon implementation steps id be thankful, and if you’re tired of explaining it you could just do it if u can id be super appreciative!

Code is simple, and you have all explanations in post from week ago.

this one:

To make rest (like cannon) or just throwing stuff use My_PlottingActor as base.