#OHhhhhhhhhhhhhh
1 messages ยท Page 1 of 1 (latest)
so what is happening if you just put in some constant?
this is odd
So..... The movement is not being applied to the object.
you set velocity to 500 and nothing happens?
Yeah.
๐ค
my best guess is that something else later in the frame is resetting the velocity
where is it?
@uncut tundra also why aren't you messaging here ๐
I saw this whoops
so it is working now?
private void HandleJumpInput()
{
if(jumpInput)
{
playerLocomotion.HandleJumping();
~~jumpInput = false;~~
}
}
Then this works, but is odd
in the original script you posted you have this line above the HandleJumping() call
not below
why did you put it below then
but anyway it shouldn't matter
lte me see the code again
playerControls.PlayerActions.Jump.performed += i => jumpInput = true;
I wonder what this is actually doing
(or supposed to do)
like
playerControls is something called Vectorman
I dunno what Vectorman is
it's not something built-in to Unity
I mean I can't google what Vectorman is
usually all classes that exist in any package related to Unity are easily googleable
so I suppose it's something you yourself implemented
Vectorman is an old 2D platformer. Name wise. That happens to be the name I chose for the input actions code.
There you go
Sorry for the confusion. I didn't understand cause I am a goober sometimes. ๐คฃ
hmm
Ok... So the problem has changed. Now, he teleports up and falls from there.
because velocity of 500 is... too much? ๐
That's with jumpInput = false; gone.
so it looks like a teleport
well velocity never teleports
if you experience it as teleport it means velocity is way too big
So..... I need to reduce the velocity then. I will test that.
velocity's purpose is to continuously change your position so that collision detection works
Dang. No matter how small, still teleports.
okay so as I see it (I'm talking about jump resetting)
when you do this you want to do jumpInput = false;
otherwise you are calling HandleJumping every frame
oh dang
and this adding a constant to velocity every frame
Making it appear to teleport.
yep
it doesn't actually teleport I think
just the velocity is that big
that you don't even notice how it moves
I set it to 1 and it did a tiny hop instead
but he doesn't keep going up?
Barely left the ground
Right.
so this is wrong
the thing I don't get is
why doesn't it work when you reset the jump
jumpInput*
ok so the thing here is
your gravity is very big
OR his mass is very big
therefore to at least make a slight hop you have to go big big velocity
(which looks like a teleport)
and yes 50 is very much
So I turned gravity down to 15. He teleports up, and then gently floats down
you don't want to modify gravity directly
Oh
modify mass of the player
because if you modify it directly it will break other things in your game ๐
So..... What do I do from here to test that?
what is advisable to do with jumps is to reduce the mass when you're moving up
for jump to appear longer and more floaty
and when you cross the upper point
get back to normal mass
to slap the player to the ground
Ok.... Wasn't that what the Sqrt was doing before though?
I've no idea what it was doing but apparently it didn't work ๐
the formula used seemed very unintuitive
True
what is the * -2 multiplier at all
Sebastian Graves ๐คฃ
I am not sure. Still learning the everything
also I dunno why your gravity was anything else than 9.8 in first place
Everything under is too slow feeling.
what do you mean too slow?
Should I just bite the bullet and redo all the movement?
for that you have mass property of rigidbody
Floats down like a piece of paper
you pretty much never should manipulate gravity itself
work with mass
or when you are absolutely conscious about it and you are just starting your project
OK. What's your recommendation from here? Any type of code you would run instead?
I'm going for 3D platformer.
well for starters I wouldn't use new fancy ui system at all
oh sorry not ui
input*
But... controllers. ๐ฅบ
I want to use one and the old one seems so complicated
Really?
yes
oh man... What do I do from here? I've integrated this thing in already.
so yes you can
you just collect user input in whatever Update() method using Input.GetAxis or GetAxisRaw
and it will automatically support controllers and keyboards
(as long as you have correct keys set in input manager)
the Input api is fairly straightforward so that's what I recommend for beginner (and honestly for anyone if you don't need fancy new features)
you just do Input.GetAxis and get your input
and it just works
So I need to go through everything and put an if statement for everything now? ๐จ
what, no
just where you handle the input
like the
what did you call it
HandleAllUserInput or something
So............................................................................................. Wait.... How do I uninstall the new input system? Do I even need to?
private void HandleJumpInput()
{
if(jumpInput)
{
playerLocomotion.HandleJumping();
jumpInput = false;
}
}
like right here
instead of this if (jumpInput) you call Input.GetAxis("Jump")
and then do what you want with this value
ehm if you don't use it - yes, delete
I shall test then. Still wondering if I need to restart the player movement.
package manager -> find input package -> uninstall
Hard reset. Try to fix it.
but obviously after you remove it from your code cause otherwise it will break it
Well.... It wasn't working anyway. Time to give it a go.
alright I need to go unfortunately, I hope I helped you at least to some extent ๐
We shall see. Thanks for your time. ๐
if you want you can dm me and I will answer tomorrow
cheers