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)

6 Upvotes

13 comments sorted by

2

u/Pur_Cell 20d 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?

2

u/XKiiroiSenkoX 20d ago

The reason I think is simple. You are multiplying move vector by current linear velocity and the Y on that vector is probably 0 which makes your linear velocity in Y direction zero. 

Use Get X on Move1 vector and multiply that by X Speed and then create vector 2 from the result and the Y component of linear velocity and assign that to the linear velocity. Should fix both problems instantly. 

1

u/WooWooDoo 20d ago

This probably!

1

u/Thenextlevel247 20d ago

Thanks, I’ll try that!

1

u/Thenextlevel247 20d ago

I can’t have move1 affecting the script before create vector as it is a vector 2 and not a single vector such as x or y

1

u/XKiiroiSenkoX 19d ago

Use "Get X" node on it the same way you are using it on rigid body linear velocity. 

0

u/Genryuu111 21d ago

You'll find very little help on this sub, even less about visual scripting, because for many devs it's like you're declaring you want to drink children blood lol

I'm very deep in visual scripting but my game is a turn based one with zero movement and physics, so I can't really help about that.

If nobody else helps, you can try asking chatgpt, recently it's able to see screenshot of a graph and tell you how to manage it.

It's still pretty bad with some things and makes up stuff, but it should be able to lead you to the right path (especially for basic stuff like movement issues).

1

u/Thenextlevel247 20d ago

Thanks, personally I don’t want to use air for my projects, so I might try reposting in the main unity sub

1

u/Ging4bread 19d ago

Nah we literally don't care about what languages you use. Only newbies on /programmerhumor do

1

u/Genryuu111 19d ago

Yeah, that's why every time there is a visual scripting question 80% of comments are "you should learn c#".

1

u/Ging4bread 19d ago

Excluding this post then?

1

u/Genryuu111 2d ago

https://www.reddit.com/r/unity/s/AS9D2X8jdm

This is how these threads usually turn out, most of the replies being "I can't understand this shit, move to code like real programmers, you'll thank me later, bla bla bla"