Adding multijump to InVector’s controller

Check the properties of an instance of InVector’s controller on my PC, and you’ll see something new:

Multijump property
Multijump property

The player’s character can jump and jump and jump some more, flying into the air. It’s a joyful mechanic.

Modify the class vThirdPersonInput. At the top:

[vHelpBox("Maximum times controller can jump in a row.")]
public int maxMultiJumps = 8;

Later:

private int _numSequentialJumps = 0;

/// <summary>
/// Conditions to trigger the Jump animation & behavior
/// </summary>
/// <returns></returns>
public virtual bool JumpConditions()
{
	// KRM
	if (cc.isGrounded)
	{
		_numSequentialJumps = 0;
		return (int)cc.GroundAngle() < cc.slopeLimit;
	}
	_numSequentialJumps++;
	if (_numSequentialJumps >= maxMultiJumps)
	{
		return false;
	}
	return !cc.customAction && !cc.isCrouching && cc.currentStamina >= cc.jumpStamina && !cc.isRolling;
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Auto
Scroll to Top