#idk hwo to do that...

1 messages · Page 1 of 1 (latest)

granite night
#

here

lean shore
#

what the

#

this is fire

granite night
#

if you want use this thread

lean shore
#

thank u bro

granite night
#

no problem, you are welcome

lean shore
#

script i found online

granite night
#

so did you test it out

vale flame
lean shore
#

im sure it would work

#

but idk why hes pulling a vector

#

wouldnt it be easier to just transform your position by a few pixels?

vale flame
granite night
#

you mean why they use the rb to move instead transform .position?

vale flame
lean shore
#

idk the terminology

vale flame
# lean shore using

ok well youd use a vector whether you set the transform position or set the rb velocity

#

a vector is a data type

granite night
#

wetnoodle already asnwered

#

if you want proper collison detectiond and stuff you have to rely on pyhsics based movement

lean shore
#

ohh dang

pliant wave
# lean shore yep yep yep

There are 2 systems in Unity: Transform is updated immediately each frame, and Physics that only updates at a fixed time step

#

Usually u want to avoid setting transform directly if u are using rigidbody, which is controlled by physics

lean shore
#

oh thank you

#

im assuming using moveInput = Input.GetAxis("Horizontal"); gets my input value from my arrow keys?

#

so like left would be -1 right would be 1

vale flame
#

so you could change the keybinds for example

granite night
#

you can Debug.Log and see what it shows you in the console

lean shore
#

but since my move input would be a constant speed

#

why would you init it as a variable above

#

public float moveSpeed = 5f;

#

this

pliant wave
#

GetAxis still have interpolation between 2 values iirc. GetAxisRaw is the one that gives u -1 and 1

lean shore
#

wouldnt i just write 5 in the code? so (moveInput * 5, rb.linearVelocity.y);

vale flame
#

and it makes it more organized

lean shore
lean shore
#

for debugs

vale flame
#

you dont want random numbers floating around

lean shore
#

i see i see

vale flame
#

it makes it confusing

pliant wave
#

U might want to check Unity Scripting Api on google

#

So u know what function do what

vale flame
# lean shore holy shit my brain is imploding

GetAxis essentially adds some easing between inputs. so for example if i held down the right then the GetAxis would return 1, but then if I switch to left there would be a few frames where it gradually decreases down to -1

#

said easing can be customized in project settings

#

GetAxisRaw essentially overrides the built in easing

lean shore
#

so basically this

lean shore
lean shore
vale flame
#

for example if I had to guess, hollow knight probably uses GetAxisRaw since that game requires precise movements\

pliant wave
#

Just run the code and see if its doing what u want

lean shore
#

so its like sacrificing smoothness for preciscion

vale flame