# Simple Logic

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;                 }             }    } ```

Hi.

I don't know if I got your point and a bit more code could help to understand your problem. For example I don't know of what class rotAxis is and what you are using (Joints?). But actually I am not the master in jme-physics, so…

The logic seems to be right, the machine has to go into the if-branch if RUN is set to true. The only thing you can do better there is to delete the line RUN=false because it has to be false if the machine reaches this line. So this isn't necessary.

I don't know how your architecture looks like, but I would simply apply forces with the addForce()-method to the DynamicPhysicsNode you probably use. I think the problem is in using the setDesiredVelocity()- and setAvaiableAcceleration()-methods.