AddForce to side stopped working

After a tons of changes to my code, I noticed that my code for side stepping stopped working but ignored it for a long time thinking it’s just something I could easily fix. But upon investigating it today, I have no clue what it wrong with it. Here’s my current code:

rb.AddForce(transform.right * moveVec.x * (moveSpd * sidestepDampening) * Time.deltaTime, ForceMode.Impulse);

I guess the only other notable changes I made from when this code was working was change the RigibBody’s mass to 10 and changed my floor’s material that have dynamic friction = 0.27 and static friction = 0.19. Move forward works fine, which have almost the same code as this one, making me more confused. I tweaked the RigidBody material thinking it was the cause of this, but didn’t really fix the problem.

alt text
Here’s my speeds, I don’t have code to change to run speed when side stepping so only walk speed is used. But even when multiplying the speed to 100, it still didn’t move

UPDATE:
I forgot to mention that moveVec is the Vector3 you get from PlayerInput so it won’t be null or zero when I try to move to the side. moveSpd , in this case which is side step, would be equal to walkSpd, so that’s can’t be zero or null as well. I’m thinking maybe this might be some RigidBody mechanism issue that I don’t know about.

Hello.

Debugg the code. Check the numeric value of all variables and the numeric result of

transform.right * moveVec.x * (moveSpd * sidestepDampening) * Time.deltaTime, ForceMode.Impulse

And check if there is any 0 or something.

Bye

Random stab in the dark since we are missing some key pieces of info…

moveVec.x or moveSpd is giving you some problems.

Its POSSIBLE that the shape of your collider might be an issue given the change in mass?!?!? Ya know, like its getting stuck or cant smoothly move across the surface because the edges on the side are colliding with the ground. Which sucks because you dont run into this issue until you start fine-tuning your game and then you have to redo a lot of crap. Which is why most developers lean toward a capsule collider for any moving characters.

There really is no way for anyone here to figure this out. We dont have the information about what causes the above variables I mentioned to be anything greater than 0.

You could debug this by doing a Debug.Log() to the console on the above 2 variables. You will know if there is any issue.

But considering your naming convention, its probably moveVec.x considering moveSpd is likely being used for both forward and side.