#you have to create a method where you
1 messages · Page 1 of 1 (latest)
send me screenshot with this part in that video
of samyam
oh wait
nah
that does make sense
yes of samyam
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
I just want it to make my character jump so I guess it the opposite I want to do
exactly what I am trying to say
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);
}
``` ??
or just -=
still does not work lmao
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);
}
I thought gravityAccelaration was negative
oh
then nice, it should work with negative and -=
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?
do you call this method somewhere?
public void DoGravity()
{
playerVelocity.y = gravityAccelaration * PlayerData.Instance.fallingSpeed;
characterController.Move(playerVelocity * Time.deltaTime);
}
yep^, at the end of my update()
yes, if gravityAccelaration is negative
if you look at the end it's happening
it's basic maths
WHY?
because in your jump you += y of velocity
right?
Have I done the biggest mistake of my life?
and then you just assign it again?
so you do:
y = -4324124213;
and then
y = 320234482310;
Before that I'm moving the charController
but between them I'm moving the char controlle
why cannot you just move it by gravity
also that doesn't make sense if you do it in single update
update happens at the same time, so if you move it with n and then -n - nothing happens
you have done something wrong then
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
Going to eat and I'll try to watch carefully the tutorial while taking note of when I've done this mistake
make sure to apply more force than gravity when jumping (to positive y direction)
also I have to go now, I am sorry
dw thank you a lot <3
@wet ermine, I think I've understand where I shit the whole thing, gonna retry a whole project just to test it again lmao
just debug it
