#vectors

1 messages · Page 1 of 1 (latest)

echo fractal
#

what's your code looking like now?

fickle granite
#

good idea on the thread lol

fickle granite
echo fractal
#

what's your scene look like?

fickle granite
echo fractal
#

ok, and when you say sliding around, can you remind me what you mean by that?

fickle granite
#

Okay my pc just died lmao

#

Oh shi

#

Idk if I saved

#

Wellllll

#

Nvm it’s still here

#

Oml that scared me

echo fractal
#

ohhhhhh

#

yeah phyics

fickle granite
#

What?

echo fractal
#

what's that blue guys components look like?

fickle granite
echo fractal
#

yeaaa

#

ok, I think I see what's up

fickle granite
#

what needs to be fixed?

echo fractal
#

linear drag is 0

#

but that's not your "problem"

#

linear drag is basically "air resistence"

fickle granite
#

what does air resistance have to do wtih this?

echo fractal
#

do you remember newton's first law?

fickle granite
#

im not a real engineer

echo fractal
#

an object in motion tends to stay in motion unless an external force acts upon it

fickle granite
#

but yes

echo fractal
#

you told your guy to move

#

so he's moving

#

or rather, you told him to set his velocity a certain way

#

motion is just velocity

#

so he's gonna keep moving unless something tells him to stop

fickle granite
#

oh

#

so what could i write to get him to stop moving when i let go

#

of the key

echo fractal
#

OnKeyUp IIRC

#

but that leaves a new problem 😉

fickle granite
#

uh oh

echo fractal
#

you'll see

#

it's not terrible

#

and you should be able to handle it

fickle granite
#

whats iirc

#

okay

echo fractal
#

"if I recall correctly"

fickle granite
#

ok

#

so how would i do "OnKeyUp" is it anew script do i add it in thee "if" statemet?

echo fractal
#

oh wait sorry

#

it's GetKeyUp

#

same place you're doing the other stuff

fickle granite
#

so like same if statement? or new?

#

sorry i suck at this lol

echo fractal
#

it's a different state, so you won't see both GetKeyDown and GetKeyUp be true for the same key on the same frame

#

else if

#

"if <condition>, then do this, else if the previous stuff was false and <condition>, then do this other stuff, and if everything else was false, then do this stuff"

fickle granite
echo fractal
#

there isn't

#

that's just how if/else if/else blocks work

fickle granite
#

else if (???)

echo fractal
#

I recommend googling that for c#

#

it'll make sense once you read up on it

fickle granite
#

okay

#

so do i not need a "if condition"?

fickle granite
echo fractal
#

you do

#

you'll see how they work when you read up on them

#

they're pretty core to programming so you'll need to know them

fickle granite
#

yes i pretty sure i need a condition

#

okay but i understand em but i dont gt what i need to put inside

echo fractal
#

well if the velocity is X, and you want it to be 0, what should you do?

fickle granite
#

rb2D.setForce?

#

or sm like that

echo fractal
#

how were you setting velocity before?

fickle granite
#

rb2D.Velocity = new Vector2(0,0);?

echo fractal
#

bingo

#

or Vector2.zero IIRC

#

there's a premade one for convenience

fickle granite
#

nope

fickle granite
echo fractal
#

👍