#jump force

1 messages · Page 1 of 1 (latest)

magic birch
#

Is the inspector value 11 or 1? @fair sun

#

also don’t multiply by mass

#

if it’s 1 in the inspector, you’ll have to share more code

fair sun
#

sorry for not responding i was away

fair sun
magic birch
fair sun
#

the player reaches 11

magic birch
#

show the full code

#

!code

tawny foxBOT
#
Posting code

📃 Large Code Blocks
Large code blocks should be posted as links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/
https://paste.myst.rs/, https://hastebin.com/

📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.

magic birch
#

surprised dyno worked here

fair sun
magic birch
#

syntax highlighting would’ve been fine, but oh well

magic birch
fair sun
magic birch
#

what is ModularPlayerPhysics?

fair sun
magic birch
#

also what’s the value of lowJumpReduce

magic birch
#

actually, better yet. Show the screenshot of the inspector

fair sun
fair sun
magic birch
fair sun
magic birch
fair sun
#

i can double jump and that resulted in me jumping to 22

magic birch
#

I think I see it now. Your custom gravity is actually super weak because it’s scaling by time delta twice

magic birch
# fair sun theyre not
jumpForce = Mathf.Sqrt(-2f * jumpHeight * -physicsScript.gravityScale * Time.fixedDeltaTime)``` try that perhaps
fair sun
#

thx

magic birch
# fair sun thx

When you say it goes up 11 units. Is that an exact measurement or a guess?

fair sun
fair sun
magic birch
fair sun
# magic birch exactly how close?

well im in another thread rn and your result got me close by the decimal, but your method cant work for unity because unity's physics system is not like real life

magic birch
#

I don’t understand what you mean on why mine won’t work for unity

fair sun
#

because unity has a different way of making physics

magic birch
fair sun
#

well it didnt

magic birch
fair sun
#

.2 units

magic birch
fair sun
magic birch
#

time the jump

fair sun
magic birch
fair sun
#

yes

magic birch
#

huh, not what I expected

fair sun
#

i mean i didnt count the jump length.
its about a normal jump

magic birch
#

like from ground to height

fair sun
#

yeah its from ground to peak but the peak is shorter than the height i inputted

magic birch
fair sun
#

gravityForce = gravityScale * gravityMultiplier;
gravityScale = 9.81
gravityMultiplier = 100

magic birch
fair sun
#

changed it a bit

magic birch
fair sun
#

yeah but i also make it stronger when falling

fair sun
#

well its no longer applied

magic birch
#

oh I see that now, you switched it to acceleration

#

lemme think for a sec

magic birch
# fair sun well its no longer applied

based on this new snippet:

        playerScript.rb.AddForce(-transform.up * gravityForce *  appliedFallForce, ForceMode.Acceleration);```
the new calculation should be 
```cs
jumpPower = Mathf.Sqrt(-2f * -gravityForce * jumpHeight);```
This is assuming that your air drag is 0 and that fall force is 1 for the entirety of the upwards movement.
fair sun
#

air drag is not 0 and the fall force is only applied once the player is already decending

#

but i think the drag might be the problem

magic birch
fair sun
#

idk

magic birch
#

set it to 0 and see if it feels ok

fair sun
#

ill try tomorrow

fair sun
#

nevermind, i think i found the problem

#

because the player is grounded for 1 frame while performing the jump, it starts with the ground drag value