# Wondering how i would create a "boost" for my game

hey guys!
I’m currently trying to create a simple kart racing game using the vehicle control class. I have come to a point where the basic driving is complete and i want to expand on it by adding a boost into the game, basically when you press a key you will get a short jolt of speed that propels you forward.

I was looking at using the applyForce(); method but it seems it takes in 2 vectors which is abit confusing, and there doesn’t seem to be a method that simply takes in an int for the power of the boost and a vector for the direction to apply the force (which would be ideal).

any help appreciated
cheers boys.

Probably one vector is the position and one is the direction. Or you could maybe use applyCentralForce().

i tried using apply central force by simply writing: vehicleControl.applyCentralForce(Vector3f.UNIT_Z); (z is the forward direction of the car)

but when i tried this it did nothing when used by pressing the boost button, here’s an example of my code for the boosting right now.

``````  public void onAction(String car, boolean isPressed, float tpf) {
if (isPressed) {
switch (car) {
case "BOOST":
if (boostCharge > 0) {
--boostCharge;
vehicleControl.applyCentralForce(Vector3f.UNIT_Z);
}
break;
case "TEMP":
if (boostCharge < 3) {
++boostCharge;
}
break;``````

For RigidBodyControls there is a setLinearVelocity() method… Not sure if something like this also exists for your vehicle.

I suggest that line to something like:
`vehicleControl.applyCentralForce(Vector3f.UNIT_Z.mult(1000));`
As the value this takes in is a force and is applied based on the mass of the car so it needs to be larger. (you could also try larger or smaller values, although it will depend on the mass of the car)

For reference the other method :
`vehicleControl.applyForce(Vector3f, Vector3f)`
Is used for applying a force offset from the center causing it to rotate in some way.

thanks for the reply guys, @Murph9 thanks for explaining the methods for me and sorry i have taken to long to reply things have been crazy for me at the moment. Im going go try out the mult 1k line now cheers. o/