#Third Person Character Controller
1 messages · Page 1 of 1 (latest)
Did that actually work? you seem to be using my older version(where i mistakenly put it in the grounded code). Anyways have an if statement that checks if num jumps is == to 2. If it is then set Gravity to a larger number. Reset both numJumps and the gravity in the same place where the if statement with the comment // stop our velocity dropping infinitely when grounded
https://pastebin.com/03FQy4xZ I wrote /* comments in the places i added stuff. I dont know if it works or not so you'll just have to test it
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I did my whole code the paste must have messed but I think I used the updated code. But yes you’re didn’t work but after editing a bit it did
In my if statement I did
if (Grounded && numJumps < 1)
{
}
else if (!Grounded && numJumps < 1
And I don’t exactly remember what else I changed but that worked
@pastel condor i need some gravity help with it now https://share.descript.com/view/tk7oc6yRZma
gravity is -9.8
private void JumpAndGravity()
{
if (Grounded && numJumps == 0)
{
// reset the fall timeout timer
_fallTimeoutDelta = FallTimeout;
// update animator if using character
if (_hasAnimator)
{
_animator.SetBool(_animIDJump, false);
_animator.SetBool(_animIDFreeFall, false);
}
// stop our velocity dropping infinitely when grounded
if (_verticalVelocity < 0.0f)
{
_verticalVelocity = -2f;
}
// Jump
if (_input.jump && numJumps < 1)//_jumpTimeoutDelta <= 0.0f)
{
// the square root of H * -2 * G = how much velocity needed to reach desired height
_verticalVelocity = Mathf.Sqrt(JumpHeight * -2f * Gravity);
numJumps++;
// update animator if using character
if (_hasAnimator)
{
_animator.SetBool(_animIDJump, true);
}
}
} else if (!Grounded)
{
// reset the fall timeout timer
_fallTimeoutDelta = FallTimeout;
// update animator if using character
if (_hasAnimator)
{
_animator.SetBool(_animIDJump, false);
_animator.SetBool(_animIDFreeFall, false);
}
// stop our velocity dropping infinitely when grounded
if (_verticalVelocity < 0.0f)
{
_verticalVelocity = -2f;
}
// Jump
if (_input.jump && numJumps < 1)//_jumpTimeoutDelta <= 0.0f)
{
// the square root of H * -2 * G = how much velocity needed to reach desired height
_verticalVelocity = Mathf.Sqrt(JumpHeight * -2f * Gravity);
_verticalVelocity -= Gravity * 2 * Time.deltaTime;
numJumps++;
// update animator if using character
if (_hasAnimator)
{
_animator.SetBool(_animIDJump, true);
}
}
}
// jump timeout
if (_jumpTimeoutDelta >= 0.0f)
{
_jumpTimeoutDelta -= Time.deltaTime;
}
// reset the jump timeout timer
_jumpTimeoutDelta = JumpTimeout;
// fall timeout
if (_fallTimeoutDelta >= 0.0f)
{
_fallTimeoutDelta -= Time.deltaTime;
}
else
{
// update animator if using character
if (_hasAnimator)
{
_animator.SetBool(_animIDFreeFall, true);
}
}
if (Grounded)
{
numJumps = 0;
}
// if we are not grounded, do not jump
_input.jump = false;
// apply gravity over time if under terminal (multiply by delta time twice to linearly speed up over time)
if (_verticalVelocity < _terminalVelocity)
{
_verticalVelocity += Gravity * Time.deltaTime;
}
}
@pastel condor
you can just increase gravity if it doesnt feel like you are falling fast enough
well its weird there is a pause at the top of the jump
it seems fine, I dont really notice anything in the video
its more prominent with this https://share.descript.com/view/YeVZY1ViJO4 and the single jump
but it doesnt feel natural this is at -15 gravity
what am i supposed to see?
ill see if I can slow it down
and untiy crashed
and i didnt save
good thing I printed the code here
@pastel condor nowim getting an error when reimporting the controller from the plugin
i found the problem
something is making grounded true forever
@pastel condor i found the problem the gravity is fine but the fall doesnt speed up like normal gravity
nope its something with my character
welp
well its my collision so i removed my collider and I want my own collider but it breaks if I have it
same with rigidbody etc