PDA

View Full Version : InSim - orientation of the car


ikkah
18th November 2005, 20:50
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?

-wes-
18th November 2005, 22:06
you can get the data you want via outsim. See the lfs readme for specs.

Kegetys
18th November 2005, 22:31
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)

-wes-
19th November 2005, 00:06
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.

ikkah
19th November 2005, 10:22
Wouldn't work well enough.

Stuff
19th November 2005, 10:28
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.. :shrug:

ikkah
20th November 2005, 10:53
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?

NiteLite
2nd December 2005, 21:51
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 :(

-wes-
2nd December 2005, 23:42
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.

NiteLite
2nd December 2005, 23:52
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 ?

-wes-
3rd December 2005, 15:57
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!

NiteLite
7th December 2005, 21:45
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 ...