View Full Version : mLocalAcceleration

27-09-2016, 06:34
I have developed a device for simulating g-forces (front, back, left, right). We are currently developing the interface to connect the device to the PC (Project C.A.R.S.). Now we urgently need the corresponding acceleration values that are sent from Project C.A.R.S. (only front/rear and left/right, so the acceleration forces occurring during braking and acceleration, and when turning corners; NOT moving up/down). We think it's the "mLocalAcceleration", but don't know wich are the values behind it for gas/brake and driving curves:
"MLocalAcceleration": [0.0101566,0.525807,3.81666]
Can someone help us please?

27-09-2016, 20:35
mLocalAcceleration is a length 3 list (or array, depending on your programming language). It's output to the telemetry as sLocalAcceleration, but there doesn't appear to be any conversion or clamping that takes place, so the values used internally in the game engine should match the values output in the telemetry exactly. I'd guess but not put money that it's just the raw G-force values, since no car can possibly generate the forces to overflow the f32 data type.

Each one of the elements of the list indicates a vector, indicating the acceleration, with the axes fixed to the vehicle position. I believe that the X-axis corresponds to the left/right (left/right) motion of the vehicle, the Y-axis corresponds to the up/down (rise/fall) motion of the vehicle, and the Z-axis corresponds to the forward/back (braking/acceleration) motion of the vehicle.

Note, I might have my vectors backward, but it'd be clear as soon as you run it!
In your example, then:

X: 0.0101566. A VERY slight (probably unnoticed) turn to the right. The acceleration vector is in the positive X direction, which is "out the right" of the car, which indicates a right turn.
Y: 0.525807. A slight rise. The acceleration vector is in the positive Y direction, which is "out the top" of the car, which indicates a rise.
Z: 3.81666. A hard acceleration. The acceleration vector is in the positive Z direction, which is "out the nose" of the car, which indicates an acceleration.

28-09-2016, 11:44
Thank you very much!

28-09-2016, 11:45
Another question: What is the difference between mLocalAcceleration and mWorldAcceleration?

28-09-2016, 15:49
The only difference between the two is how the axes are oriented:

The axes for mWorldAcceleration are oriented to the world. X is West-East, Z is North-South, Y is Up-Down.
The axes for mLocalAcceleration are oriented to the car. X is Left-Right, Z is Front-Back, Y is Up-Down.

For a car on a perfectly level surface, facing north, the axes are aligned and identical. Turn that car to the right (rotating about the Y axis), and the X and Z axes are no longer the same between the two, while the Y axis remains the same. Tilt the front of the car up, and now all the axes are different.

For a motion simulator, mLocalAcceleration is what you'd want. mWorldAccleration would be more accurate for something like a map plot.

25-11-2016, 02:19
In my testing it appears that PC uses the Left-Up-Back (X, Y, Z respectively) local frame. (Somebody should be flogged for choosing a left-hand system!) This translates to the West-Up-South world system, but I didn't test it directly.

Angular velocities (mAngularVelocity) follow this convention (becoming pitch, yaw, roll rates), including signs (pitch down is positive, etc.)

However, Euler angles (mOrientation), while having the same order, show opposite sign (positive pitch up, roll right). This matches the common agreement with these angles direction, but is inconsistent with the chosen axis frame. Which is all quite annoying, yet so common in games...