Weird swinging physics

So I’m trying to create a first person swinging game by following pretty much all the tutorials on youtube about swinging mechanics and grappling guns (my main source is Dave / GameDevelopment) and I’m having this issue where if I try to swing to the right my character’s speed suddenly drops to almost zero, making the swinging feel very annoying.Every other direction is fine, it only happens when I try to swing to the right. I’ve noticed that it happens almost instantly when I look down, but I have absolutely no clue where my problem could be. I’ve been reviewing my code and game objects for a week now and couldn’t find the source of the problem. I’d really appreciate it if y’all could help me out. Let me know if I should provide any more info.

The player movement script that’s attached to the Player: https://pastebin.com/RVd7wvwT
The swinging script, that’s also attached to the Player: https://pastebin.com/dgixFnhi
Video of the speed drop: Imgur: The magic of the Internet

Time to start debugging!! By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.

NOTE: most swinging physics games don’t use “real” physics: they may use a physics system but there is often forces and tweaks done to keep it interesting, otherwise the user will feel like they “stall out” a lot.

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

1 Like