```cs
//the adjust veocity code, where the xAxis and zAxis are used
void AdjustVelocity()
{
float acceleration;
Vector3 xAxis, zAxis;
walkOrRunSpeed = (Input.GetKey(KeyCode.LeftShift)) ? maxRunSpeed : maxWalkSpeed;
acceleration = OnGround ? maxAcceleration : maxAirAcceleration;
xAxis = rightAxis;
zAxis = forwardAxis;
xAxis = ProjectDirectionOnPlane(xAxis, contactNormal);
zAxis = ProjectDirectionOnPlane(zAxis, contactNormal);
//Debug.Log("xAxis: " + xAxis + "zAxis: " + zAxis);
Vector3 relativeVelocity = velocity - connectionVelocity;
float currentX = Vector3.Dot(relativeVelocity, xAxis);
float currentZ = Vector3.Dot(relativeVelocity, zAxis);
//float acceleration = OnGround ? maxAcceleration : maxAirAcceleration;
float maxSpeedChange = acceleration * Time.deltaTime;
float newX = Mathf.MoveTowards(currentX, playerInput.x * walkOrRunSpeed, maxSpeedChange);
float newZ = Mathf.MoveTowards(currentZ, playerInput.y * walkOrRunSpeed, maxSpeedChange);
velocity += xAxis * (newX - currentX) + zAxis * (newZ - currentZ);
}
//the projectOnPLane function where they also are used
Vector3 ProjectDirectionOnPlane(Vector3 direction, Vector3 normal)
{
return (direction - normal * Vector3.Dot(direction, normal)).normalized;
}
//this is how contactNormal is gained
void OnCollisionEnter(Collision collision)
{
EvaluateCollision(collision);
}
void OnCollisionStay(Collision collision)
{
EvaluateCollision(collision);
}
void EvaluateCollision(Collision collision)
{
int layer = collision.gameObject.layer;
float minDot = GetMinDot(layer);
for (int i = 0; i < collision.contactCount; i++)
{
Vector3 normal = collision.GetContact(i).normal;
float upDot = Vector3.Dot(upAxis, normal); //new, checks what kind of contact we have
//Debug.Log("normal and updot: " + normal + "" + upDot + "upaxis: " + upAxis);
if (upDot >= minDot)
{
groundContactCount += 1;
contactNormal += normal;
connectedBody = collision.rigidbody;
//Debug.Log("When does this call?"); //gets called when standing on flat ground
if((bounceMask & (1 << layer)) != 0)
{
BouncePlatform bouncePlatform = collision.gameObject.GetComponent<BouncePlatform>();
Vector3 jumpDirection = contactNormal;
float jumpSpeed = Mathf.Sqrt(2f * gravity.magnitude * jumpHeight);
jumpDirection = (jumpDirection + upAxis).normalized;
body.AddForce(jumpDirection * jumpSpeed * bouncePlatform.GetBounceForce(), ForceMode.Impulse);
}
}
//else if (upDot > -0.01f) {
else
{
if (upDot > -0.01f)
{
steepContactCount += 1;
steepNormal += normal;
if (groundContactCount == 0)
{
connectedBody = collision.rigidbody;
}
}
}
}
}
```