- Home /
Implementing Counter-Movement
I've tried adding countermovement in multiple ways so far, such as: if(isWalking){ if(canJump > 0) { moveSpeed = walkSpeed; //Lerps Move Speed to Walk Speed idealDrag = moveSpeed / maxWalkSpeed; //Counter-movement Calculation } } if(isSprinting){ if(canJump > 0) { moveSpeed = sprintSpeed; //Lerps Move Speed to Sprint Speed idealDrag = moveSpeed / maxSprintSpeed; //Counter-movement Calculation } } if(isGrounded){ rb.drag = (idealDrag / (idealDrag Time.fixedDeltaTime + 1)); //Counter Movement Formula & Appliance* }
This formula works really great for counter-movement and all but, the biggest down side for it is when you start adding the jumping mechanic. I've added a jump mechanic with this formula and the biggest issue I encountered with it is the inconsistency in jump height. The root for this cause was the code I've put above, for some reason it sometimes impacts my jump height (i have another statement that sets my drag to 0 once im in the air). Now, since this isn't working, I just want to have an idea on how everyone else does their countermovement because I'm sort of struggling here ;/ Anyway, have a great day and I'd appreciate any help!
Your answer
Follow this Question
Related Questions
How do I stop unwanted rotations? 4 Answers
How to make a rigidbody move in the direction of finger(x,y,z) 1 Answer
How to move Character with Addforce? 1 Answer
Child object not moving with parent 3 Answers
move enemy to old position of player 2 Answers