#idk hwo to do that...
1 messages · Page 1 of 1 (latest)
if you want use this thread
thank u bro
no problem, you are welcome
script i found online
so did you test it out
yeah thats one way to do it, id encourage you to make the movement urself tho
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?
what do you mean by pulling a vector?
you mean why they use the rb to move instead transform .position?
setting transform position isnt compatible with unity physics
ok well youd use a vector whether you set the transform position or set the rb velocity
a vector is a data type
yep yep yep
wetnoodle already asnwered
if you want proper collison detectiond and stuff you have to rely on pyhsics based movement
ohh dang
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
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
yes, and the axis can be found in your project settings
so you could change the keybinds for example
you can Debug.Log and see what it shows you in the console
but since my move input would be a constant speed
why would you init it as a variable above
public float moveSpeed = 5f;
this
GetAxis still have interpolation between 2 values iirc. GetAxisRaw is the one that gives u -1 and 1
wouldnt i just write 5 in the code? so (moveInput * 5, rb.linearVelocity.y);
so that you can customize it in the inspector
and it makes it more organized
holy shit my brain is imploding
you dont want random numbers floating around
i see i see
it makes it confusing
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
oh shit thank you
ohh so the movement wouldnt be choppy sudden left right weave movements
honestly it kinda depends on the situation for whether u wanna use GetAxis or GetAxisRaw
for example if I had to guess, hollow knight probably uses GetAxisRaw since that game requires precise movements\
Just run the code and see if its doing what u want
idk that game but noted
so its like sacrificing smoothness for preciscion
Sorta but honestly a pretty miniscule difference most of the time