Math expression, I need to use maths and science help. Math expression does not accept negative numbers.

I need to introduce angle = atan(10^2-sqrt(10^4-9.8(9.85^2-20*5^2))) / ( 9.8 * 5))

If I introduce that in my home calculator and linux ubuntu calculator good but when I use math epxression of unreal it is some sort of a chaos any idea?

The formula is to predict the parabolic shots. acceleration uniform.

And negative numbers become a pain. In math expression.

In linux calculator

atan((10^2-sqrt(10^4-9,8(9,8×5^2-2×0×5^2))) / ( 9,8 × 5)) this works in calculator, why not in unreal ?

What do you mean by “it’s not working”? Does it give an error? Is it not precise enough? And if it outputs the wrong result, you can share your blueprint code. Please explain your issue in more detail

Hello thank you to answer that quick, I have decided to not use mat expression and enter manually the paremeters and solve manually the equation

This is how it looks like

This is free to use for anyone no copyrights or whatever CCO or well idk…

Emmmh to calculate the needed (angle) having (distance needed) and ( initial velocity ) Non 3d just vector length and (altitude Yo) and ( custom gravity )…

I also used Chat GPT because it solved the equation part by part for me, it is awesome…

To solve it with chat GPT use…

calculate atan((10^2-sqrt(10^4-9,8(9,8×5^2-2×0×5^2))) / ( 9,8 × 5)) or calcula or whatever your language is…

Thanks! I wish unreal made better math expression at some point it can be good for us the only blueprint gameplay coders… In c++ it would have been easier but I rather blueprints for the quick coding.
And yeah

https://www.youtube.com/watch?v=2H3HzzTg8lk&t=111s this dude helped me from this youtube channel…

I had that the altitude height did not do much there mmmmmmh this is a new formula different from chat GPT i don’t know what I did but it works anyways unless I see it has errors…

New formula here… for θ = arctan ((vₒ²±sqrt(vₒ⁴-g(g·D²-2·yₒ·vₒ²)))/(g·D))

It is wrong too I am fixing it :.) next version v3 ( the stuff on the imagethe bps )

I could help you out if you clearly explained what the issue is. To communicate more efficiently, you can consider translating your reply beforehand and listing your goals with some bulletpoints.

Hello version 3 is here.

Context: After a teacher told me the formula to get the angle he told me this, he is on youtube…
pissarra cat… something like that…

This is the formula NecessaryAngle = atan((10^2-sqrt(10^4-9.8(9.85^2-20.110²)))/(9.85)) = 13.44121698

And in the blue world blueprints is:

Context: I used a game of ours of Creative Oven Studios called liberation special forces 1 version weapons… with rocket launchers to use the formula of parabolic trajectory by: " wikipedia " says galileo galiley “something like that” in 1600 about that year "but I am sure greeks and romans in the ancient era already developed something like that… to predict the necessary angle to reach a distance with a rocket…

example of parameters
ExampleGoodParameters

Rocket launcher

YERPG not RPG don’t get confused it is a fictional world…

results:

8.529 degress.

well the parameters were following ones:

h: 88 uus
v: 5000 uus/s
d: 7500 uus/s
g: (Gravity) 980 uus/s positive i believe or it can fail

TRUE it gives 7948 not accurate 100% BUT the h the height it was not very precise as the cylinder height is uncertain to be the right altitude where the shot is performed I know a trace to floor would be ok but not enough…

And also other results were very excellent specially long distances.

This website builds the blueprints pretty much no chatGPT and other AI well considering this is not AI … well I don’t even understand what the concept AI is, even if is a tranding topic…

Also don’t tell me hey there already spliny trajectory prediction in unreal I know but I just wanted to experiment…

Here is the video explaining it all.

I cannot introduce a formula in math expression simple as that it just won’t do as the regular calculator…

image

1 Like

LoL… I recommend to use that it is way advanced but well, you never know it has it’s advantages like… mmmmh idk… maybe the maximum height of the projectile? Of my trajectory prediction thing on blueprints.

1 Like

Install visual C. Make function in function library (in C++). Then you can write those calculations right into C++ code.

Also it looks like your formula does not have any variables, so it is constant, you can calculate value for it in calc then use that number.

Hey Nawrot I rather keep it all clean and pure bps rather than c++… But if that is more efficient… and for what reasons…

Also Nawrot what do you mean by calc, open/libre office calc ? will that show how to elaborate the formula…?

All values in your formula are constant numbers, so calculate it elsewhere, put result in code.

Just gravity is? I mean it is taking other values if you want instead of 1000UUs/s initial speed maybe 5000 UUs/s…

example:

Vo= 1000 UU/s
g = 980 UU/s
h = 10 UU
D = 2500 UU
angle = ? that is what we are suposed to find that is the formula
t = ? same here we should find that WIP

atan((((pow(10.000000, 2.000000)) - (sqrt(((pow(10.000000, 4.000000)) - (9.800000 * ((pow(9.850000, 2.000000)) - (20.000000 * (pow(5.000000, 2.000000))))))))) / (9.800000 * 5.000000)))

Good luck keeping track of the parentheses.

1 Like

Is that some sort of c++ inverse nativizer? from c++ to blueprints I don’t get it sorry.

I might have taken this too literally and assumed you were referring to Math Expression Node for angle = atan(10^2-sqrt(10^4-9.8(9.85^2-20*5^2))) / ( 9.8 * 5)), which would look like this:

I don’t want to ruin your day, but there are way too many parenthesis…
that is hard… so hard? How did you manage to introduce that equation in math expression ?

Yeah, they are added automatically for some reason.

Select the node and press F2 or in the Details tab where it says Name.


In case it happens to you: I had an issue with a specific UE 5 version where they are bugged, they crash the editor after any edit. Don’t remember which one, but seems to be fixed for 5.4.

2 Likes