localWalkDirection.set(walkDirection).normalizeLocal();
//check for the existing velocity in the desired direction
float existingVelocity = velocity.dot(localWalkDirection);
//calculate the final velocity in the desired direction
float finalVelocity = designatedVelocity - existingVelocity;
localWalkDirection.multLocal(finalVelocity);
//add resulting vector to existing velocity
velocity.addLocal(localWalkDirection);
}
rigidBody.setLinearVelocity(velocity);
if (jump) {