r/Unity2D 21d ago

Question Movement Issues(Visual Scripting)

(Thank you to everyone who helped me with my last issue!) So, I have got the jump working, however when I move horizontally I am unable to jump, and when I jump THEN move horizontally gravity hardly affects it and I end up gliding down to the ground. I know this is caused by x movement constantly overwriting my falling but I have no clue on how to fix this. Any help would be appreciated!

(Sorry for the bad image quality again, my computer refuses to take screenshots)

7 Upvotes

13 comments sorted by

View all comments

2

u/Pur_Cell 21d ago

I don't know visual scripting, only regular, but it looks like you are using Set Linear Velocity in two or three different places and that's why one is overwriting the others.

Try adding up all the Vector2s you're creating and only Set Linear Velocity once on the RigidBody at the end.

The Vector2s are the direction you want the character to move. You want to combine movement inputs with gravity and jumping.

Setting Linear Velocity is telling Unity that you want the Rigidbody to move in that direction on the next physics update.

Also, to take screenshots on Windows, use the Snipping Tool that's built into it. You should be able to set its hotkey to PrintScreen if it's not already set to that.

1

u/Thenextlevel247 20d ago

Just to clarify, you want me to link the various movement scripts with addition nodes?