I know its simple logic but i'm having slight difficulties getting tis implementation to work in the begining I set the RUN boolean to true just in order to getting a theoretical working one however 1 it doesn't accelerate and two i don't think its the best way since I want RUN to be true after everything is said and done
/**
* Accelerates uniformly until maxSpeed is met and then decelerates to desiredForce
* @param desiredForce
* @param acceleration
* @param direction
* @param maxSpeed
* @preCondition {@link characterMove#move(int scale, Vector3f direction)} is called
*/
public void moveForward(int desiredForce, float acceleration, Vector3f direction, int maxSpeed){
if (desiredForce == 0){
rotAxis.setDesiredVelocity(0);
}else{
if(direction!=null){rotAxis.setDirection(direction);}
if(RUN)
{ rotAxis.setDesiredVelocity(maxSpeed);
rotAxis.setAvailableAcceleration(acceleration/(desiredForce*10));
if(rotAxis.getVelocity()>maxSpeed-1){RUN=false;}
}else{System.out.println("check");
rotAxis.setDesiredVelocity( desiredForce );
rotAxis.setAvailableAcceleration( acceleration );
RUN=false;
}
}
}