Relative Content

Tag Archive for c#unity-game-enginecollision-detection

How do I fix a collision-skipping bug on my character controller?

I have a player object which is parent to a cylinder object (simply for sprite), MainCamera object, and a checkGround object so that I can check if it is touching the ground in order to jump. The following code is my playermovement code and aside from the fact that it skips in certain conditions, it is working completely fine. I also have a mouseMovement script (attached below) that allows the first person camera rotation (which actually rotates the player object itself). I have clamped the rotation from -45 to 45 degrees on y axis, so that the player can look up the sky or down the ground. Whenever I rotate the camera to a certain agree (and the player rotation hits a certain number), if I move the opposite way I’m leaning to, the object starts skipping (jumping slightly). And if I jump while skipping like that, the object jumps (I suppose) double the amount of jump height. And the vice versa occurs: My jump actions on the way I’m leaning on are hindered, I suppose, half the amount of my jump height.