#OHhhhhhhhhhhhhh

1 messages ยท Page 1 of 1 (latest)

uncut tundra
#

ok

sick crater
#

so what is happening if you just put in some constant?

uncut tundra
#

Y is now = to 500

#

no movement though

sick crater
#

this is odd

uncut tundra
#

So..... The movement is not being applied to the object.

sick crater
#

you set velocity to 500 and nothing happens?

uncut tundra
sick crater
#

๐Ÿค”

#

my best guess is that something else later in the frame is resetting the velocity

uncut tundra
#

FOUND SOMETHING

#

OH WOW

#

It is this "On jump performed."

#

Screenshot...

sick crater
sick crater
#

@uncut tundra also why aren't you messaging here ๐Ÿ™‚

sick crater
#

so it is working now?

uncut tundra
#

private void HandleJumpInput()
{
if(jumpInput)
{

        playerLocomotion.HandleJumping();
        ~~jumpInput = false;~~
    }
}

Then this works, but is odd

sick crater
#

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

sick crater
#

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

uncut tundra
#

Yeah. That's just the new input system name.

#

For the player actions.

sick crater
#

can you link me to corresponding docs page?

#

I can't find it

uncut tundra
#

uh.... I don't know how to. ๐Ÿ˜…

#

Where do I go for that?

sick crater
#

usually all classes that exist in any package related to Unity are easily googleable

#

so I suppose it's something you yourself implemented

uncut tundra
#

Vectorman is an old 2D platformer. Name wise. That happens to be the name I chose for the input actions code.

sick crater
#

yeah

#

show it

#

the Vectorman class

uncut tundra
#

There you go

#

Sorry for the confusion. I didn't understand cause I am a goober sometimes. ๐Ÿคฃ

sick crater
#

hmm

uncut tundra
#

Ok... So the problem has changed. Now, he teleports up and falls from there.

sick crater
uncut tundra
#

That's with jumpInput = false; gone.

sick crater
#

so it looks like a teleport

uncut tundra
#

I reduced it to 50.

#

Short hop.

sick crater
#

well velocity never teleports

#

if you experience it as teleport it means velocity is way too big

uncut tundra
#

So..... I need to reduce the velocity then. I will test that.

sick crater
#

velocity's purpose is to continuously change your position so that collision detection works

uncut tundra
#

Dang. No matter how small, still teleports.

sick crater
#

okay so as I see it (I'm talking about jump resetting)

sick crater
#

otherwise you are calling HandleJumping every frame

sick crater
#

and this adding a constant to velocity every frame

uncut tundra
#

Making it appear to teleport.

sick crater
#

yep

#

it doesn't actually teleport I think

#

just the velocity is that big

#

that you don't even notice how it moves

uncut tundra
#

I set it to 1 and it did a tiny hop instead

sick crater
#

but he doesn't keep going up?

uncut tundra
#

Barely left the ground

uncut tundra
sick crater
#

wtf

#

hmm

#

actually no we are setting velocity directly

sick crater
#

the thing I don't get is

#

why doesn't it work when you reset the jump

#

jumpInput*

sick crater
#

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

uncut tundra
#

So I turned gravity down to 15. He teleports up, and then gently floats down

sick crater
uncut tundra
#

Oh

sick crater
#

modify mass of the player

#

because if you modify it directly it will break other things in your game ๐Ÿ™‚

uncut tundra
#

So..... What do I do from here to test that?

sick crater
#

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

uncut tundra
#

Ok.... Wasn't that what the Sqrt was doing before though?

sick crater
#

I've no idea what it was doing but apparently it didn't work ๐Ÿ™‚

#

the formula used seemed very unintuitive

uncut tundra
#

True

sick crater
#

what is the * -2 multiplier at all

uncut tundra
#

Sebastian Graves ๐Ÿคฃ

sick crater
#

why is Sqrt here at all

#

etc

uncut tundra
#

I am not sure. Still learning the everything

sick crater
#

also I dunno why your gravity was anything else than 9.8 in first place

uncut tundra
#

Everything under is too slow feeling.

sick crater
uncut tundra
#

Should I just bite the bullet and redo all the movement?

sick crater
#

for that you have mass property of rigidbody

uncut tundra
sick crater
#

work with mass

sick crater
uncut tundra
#

OK. What's your recommendation from here? Any type of code you would run instead?

#

I'm going for 3D platformer.

sick crater
#

oh sorry not ui

#

input*

uncut tundra
sick crater
#

what's wrong with them?

#

you can easily support them without new ui

uncut tundra
#

I want to use one and the old one seems so complicated

uncut tundra
sick crater
#

yes

uncut tundra
#

Dang.

#

All these youtubers hyped up the new UI system so much...

sick crater
#

or wait can you actually

#

๐Ÿ˜„

uncut tundra
#

WAT

#

WUT

sick crater
#

actually you just use axes from the input manager

#

for instance

uncut tundra
#

oh man... What do I do from here? I've integrated this thing in already.

sick crater
#

so yes you can

sick crater
#

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

uncut tundra
#

So I need to go through everything and put an if statement for everything now? ๐Ÿ˜จ

sick crater
#

just where you handle the input

#

like the

#

what did you call it

#

HandleAllUserInput or something

uncut tundra
#

So............................................................................................. Wait.... How do I uninstall the new input system? Do I even need to?

sick crater
#
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

sick crater
uncut tundra
#

I shall test then. Still wondering if I need to restart the player movement.

sick crater
#

package manager -> find input package -> uninstall

uncut tundra
sick crater
#

but obviously after you remove it from your code cause otherwise it will break it

uncut tundra
#

Well.... It wasn't working anyway. Time to give it a go.

sick crater
#

alright I need to go unfortunately, I hope I helped you at least to some extent ๐Ÿ˜…

uncut tundra
#

Oh! It didn't need an uninstall!

#

They updated it to use either or!

uncut tundra
sick crater
#

cheers