#Hey folks anyone here have use physics

1 messages ยท Page 1 of 1 (latest)

static tangle
#

Hey, I think the formula to find the initial velocity (u) = sqrt-2as. You're missing the negative sign inside the sqrt.

Your code calculates : sqrt(2 * -980 * jumpHeight), which is the square root of a negative number.
So the correct calculation should be sqrt(-2 * -980 * jumpHeight).

so : Sqrt(-2.0f * Acceleration * Displacement)

lucid finch
#

๐Ÿค”

#

now thats doesnt work :(.. maybe im using mover instant movement effect wrong

#

i got my final velocity somewhere around 58,000

tested with set my jumpheigh whic i set to 300cm/s

then feed it here:
300cm/s * -980 * 2
which get absurd number

#

and mover velocity and its moveintent just register that as nand

#

i think this is a logic issue on my end

#

which i still cant figue out how to do this

#

close to just go to chatgpt for this

#

ugh

static tangle
#

Are you getting 588000 ?

#

โˆ’2ร—โˆ’980ร—300=588000

sqrt(โˆ’2ร—โˆ’980ร—300)โ‰ˆ766.96

lucid finch
lucid finch
#

I'll double check tomorrow

static tangle
lucid finch
#

okay so its somewhat a logic error on my end, kinda got it to work now

#

here my current solution

lucid finch
#

@static tangle

#

here what i get when log it

#

should be correct now

#

not sure

static tangle
#

Yeah i think we solve the core math

#

Maybe you can simplify the CalculateJumpVelocity function to only calculate and return the pure jump impulse

#

Because it's just confusing and not reusable, like if another system in your game needed to know how strong a jump would be, you couldnt use this function because it does more than just calculate the value.
Why this is also responsible for handling the caracters existring momentum.

static tangle
lucid finch
#

@static tangle thank you so much for your help titoux.. learn a ton along the way ๐Ÿ˜„

static tangle
#

Yeah np, just maybe one thing that i notice

static tangle
# lucid finch <@833359473350672384> thank you so much for your help titoux.. learn a ton along...

In ActivateAbility, bAdditiveVelocity
So you manually created the final velocity but then told the effect to add it again by setting bAdditiveVelocity to true. This can leads to some bugs and incorrect physics.
So like let's say the character is on an elevator moving up at 100 cm/s. Their current velocity is (0, 0, 100).

CalculateJumpVelocity gets (0, 0, 100).
It zeroes the Z-axis, making it (0, 0, 0).
It adds the jump impulse, making the final velocity (0, 0, 423).
The character's jump is effectively weaker because the elevator's upward push was ignored.

#

So the Physics Realistic Code should be :

CalculateJumpVelocity returns only the pure impulse: (0, 0, 423).
ActivateAbility gives this impulse to the effect with bAdditiveVelocity = true.
The Mover component sees the character's current velocity is (0, 0, 100).
It adds the impulse: (0, 0, 100) + (0, 0, 423) = (0, 0, 523).

So it can really add a jump impulse

lucid finch
#

AH i didnt know that could happen

#

will take that into consideration