# Car Physics and Speed

I am using a FancyCar (Car) object in JME3 as the "cars" in my project. I have a basic implementation set up, but I have having difficulty in the following areas.

1. I want to output the car speed in MPH as a primitive speedometer. I use this code to obtain this number (assuming velocity is in units/second, where 1 unit = 1 foot):

`float speedMPH = (3600f / 5280f) * FastMath.sqrt(FastMath.sqr(currentCar.getPlayer().getLinearVelocity().x) + FastMath.sqr(currentCar.getPlayer().getLinearVelocity().z))`

The code should only apply to the X and Z axes, not the Y axis (which represents height). I noticed that there is a getCurrentVehicleSpeedKmHour() method, however using that method instead of the above code yields high numbers. For example, ~130 MPH = ~700 KPH, which I know is not correct. Since the MPH number seems more reasonable, I am wondering if the unusually high KPH number might explain something else:

2. I have a road entity that is completely flat along the X and Z axes (Entity #1). I have another entity that has different dimensions but is still completely flat along the X and Z axes (Entity #2). The car behaves properly when driven on Entity #1, but about halfway along Entity#2, the car bounces and is very unstable. When I looked at the car with the flycam, I saw that the wheels were glitching between being where they're supposed to be and somewhere above the car. This causes the bouncing, but I don't know why the wheels glitch like that.

I did have a handling problem, but I fixed that with some minor changes. I am wondering if there's anything I can do to fix the speed problem and/or the wheel glitch problem.

late to the game here but this is because the jme method getCurrentVehicleSpeedKmHour() is considering 1 unit as 1 meter, I believe. change 5280 (feet in a mile) to 1609.34 (meters in a mile) (https://www.google.com/search?client=opera&q=meters+in+a+mile)