#you have to create a method where you

1 messages · Page 1 of 1 (latest)

wet ermine
#

your condition just doesn't make sense.

lusty mortar
#

I know but I tried to just follow the tutorial

#

:§

wet ermine
#

send me screenshot with this part in that video

#

of samyam

#

oh wait

#

nah

#

that does make sense

lusty mortar
#

yes of samyam

wet ermine
#

because it can jump just if it's grounded

#

my bad

#

anyway you just make y += neg value

#

fix this

#

that's all

#

so you basically subtract value from y

#

that's not what you want

#

you just increase the gravity this way

#

you have to make positive value on right side of += operator

lusty mortar
#

I just want it to make my character jump so I guess it the opposite I want to do

wet ermine
lusty mortar
#
if (InputManager.Instance.PlayerJumpedThisFrame() && isGrounded)
        {
            playerVelocity.y += Mathf.Sqrt(PlayerData.Instance.jumpHeight * -3.0f * gravityAccelaration);
        }

Become

if (InputManager.Instance.PlayerJumpedThisFrame() && isGrounded)
        {
            playerVelocity.y += -Mathf.Sqrt(PlayerData.Instance.jumpHeight * -3.0f * gravityAccelaration);
        }
``` ??
wet ermine
#

or just -=

lusty mortar
#

It's not logic at all, am i wrong ?

#

-= ?

#

Lemme try

wet ermine
#

just tryitandsee

lusty mortar
#

still does not work lmao

wet ermine
#

that should work

#

just check if you assing velocity correctly

#

oh nah

lusty mortar
#
private void Update()
    {
        Vector2 movement = InputManager.Instance.GetPlayerMovement();
        Vector3 movementVector = new Vector3(movement.x, 0, movement.y);
        characterController.Move(movementVector * Time.deltaTime * PlayerData.Instance.walkingSpeed);

        if (InputManager.Instance.PlayerJumpedThisFrame() && isGrounded)
        {
            playerVelocity.y += -Mathf.Sqrt(PlayerData.Instance.jumpHeight * -3.0f * gravityAccelaration);
        }

        characterController.Move(playerVelocity * Time.deltaTime);
        DoGravity();
    }

    public void DoGravity()
    {
        playerVelocity.y = gravityAccelaration * PlayerData.Instance.fallingSpeed;
        characterController.Move(playerVelocity * Time.deltaTime);
    }
wet ermine
#

I thought gravityAccelaration was negative

lusty mortar
#

Maybe it does come from the DoGravity() of after?

#

It's negative

#

wait look

wet ermine
lusty mortar
wet ermine
#

then nice, it should work with negative and -=

lusty mortar
#

Valeur de la gravité is the french of Gravity value

#

wait

#

gonna try again

#
playerVelocity.y -= Mathf.Sqrt(PlayerData.Instance.jumpHeight * -3.0f * gravityAccelaration);
#

like this?

wet ermine
#

do you call this method somewhere?

    public void DoGravity()
    {
        playerVelocity.y = gravityAccelaration * PlayerData.Instance.fallingSpeed;
        characterController.Move(playerVelocity * Time.deltaTime);
    }
lusty mortar
#

yep^, at the end of my update()

wet ermine
lusty mortar
#

if you look at the end it's happening

wet ermine
#

it's basic maths

lusty mortar
#

okay

#

gonna try

#

Ik

wet ermine
lusty mortar
#

but i can't figure why it don't work

#

Because it's gravity ? 🥲

wet ermine
#

right?

lusty mortar
#

Have I done the biggest mistake of my life?

wet ermine
#

and then you just assign it again?

lusty mortar
#

wait

#

no

wet ermine
#

so you do:

y = -4324124213;

and then

y = 320234482310;
lusty mortar
#

Before that I'm moving the charController

#

but between them I'm moving the char controlle

wet ermine
#

why cannot you just move it by gravity

#

also that doesn't make sense if you do it in single update

lusty mortar
#

Should I ?

#

I've done it as in the tutorial

wet ermine
#

update happens at the same time, so if you move it with n and then -n - nothing happens

wet ermine
#

try to follow tutorial better

#

check velocity before you apply it

#

if you jump, your velocity's y should be positive

#

not negative

#

and jump should apply force instantly

#

maybe there is not enough force

lusty mortar
#

Going to eat and I'll try to watch carefully the tutorial while taking note of when I've done this mistake

wet ermine
#

make sure to apply more force than gravity when jumping (to positive y direction)

#

also I have to go now, I am sorry

lusty mortar
#

@wet ermine, I think I've understand where I shit the whole thing, gonna retry a whole project just to test it again lmao

wet ermine
#

just debug it