The online racing simulator
InSim - orientation of the car
(12 posts, started )
#1 - ikkah
InSim - orientation of the car
Hey,

why is it that you can get the position of the car in 3d (x, y and z), but you can only get 2d orientation (y-axis angle)? Could we get just a few extra bytes for 3d orientation?
#2 - -wes-
you can get the data you want via outsim. See the lfs readme for specs.
Quote from -wes- :you can get the data you want via outsim. See the lfs readme for specs.

But that only works for the player's car (or whatever car you're viewing currently)
#4 - -wes-
hmmm what about the camera packet?
You could keep switching the camera from car to car and get the angle data from the camera.

If the view is from in car or bumper it should match angles with the car.

It depends on how fast you need the data, dont think the method would be fast but you could try it.
#5 - ikkah
Wouldn't work well enough.
#6 - Stuff
Hmm.. I dunno what else there is either? Maybe give us the reason why you need the 3d orientation (pitch and roll) and think of another approach..
#7 - ikkah
Well there's no specific reason, it's just something that has troubled me (and Kegetys). There were a few ideas that are impossible to do well without 3d orientation. I was kinda hoping to get an answer from the devs on this one?
I am currently trying to using the Direction and Heading information in the CompCar struct to try to find the angle of the car ... Problem is, it seams to only be working with 0 to 180 degrees ... if the car is within 180 to 360 (or -180 to 0 if you like) if get the following CompCar struct ...

0104 01 02 003f3e3f 3f3f3f6b 00013e3f 033f 3f3f 3f3f 3f70

Both the Direction and the Heading values come out as 3F3F

Within 0 to 180 degrees its something like:

0102 01 02 003f3f3f 3f3f3f3f 00012055 060f 5c3f 5627 0962


The manual defines these values as word (2-byte unsigned integer) so i am having problems making the angles work properly
#9 - -wes-
Direction goes a bit funny if the car is stopped. It jumps around for me, dont know why.

But dont forget that the values are from 0 to 65536
You have to convert them into degrees.

so 1 deg = 65536/360

= 182 units per degree


a car angle of 25 deg will = 25*182

=4550 units

do : 4550/182 = 25
to get back to degrees.

I dont know if your getting the values correctly, we would need to see some code.
Whats funny is the fact that the values never reach 65536 ...

When i drive the car around in a circle the values (convert to an unsigned 16 bit int) go from 0 to 32700ish and then they suddenly jump to 16191 and stay around 16191 jumping irradicly +/- 100 untill i get to 0 around and it all starts over

The actually convertion of units = degrees is working fine, but the packets i recieve from LFS suddenly only contain 3F3F as the value for Direction and Heading when i pass 180 degrees...

I guess that its working fone for you since you dont seam to have had this problem ?
To store dirction and heading i'm using the 'unsigned short' data type but the value should be intact if cast to an int.

Must be a bug in your program somewhere, happy hunting!
It seams there is a bug with the direction and heading when using the in-game server. I switched to the dedicated host and now its working perfectly ...

InSim - orientation of the car
(12 posts, started )
FGED GREDG RDFGDR GSFDG