PDA

View Full Version : Getting road and track bounds from PTH files


LupusC
26th December 2005, 15:28
Hi,

I have problems with pth files. My intention is to create a 2D image of the track. Similar to the performance analyzer.

But how do I get/calculate the coordinates for the road and track bounds ? I searched intensively but didn't find anything.

Thanks for help.

Phill
26th December 2005, 23:46
ask the devs, was what jumped my mind at first.

-wes-
28th December 2005, 12:58
from programmers files on the web site:

Have you looked at pth.txt?
come with the smx meshes. anyway;

NODE BLOCK :

1 int 0 centre X : fp
1 int 4 centre Y : fp
1 int 8 centre Z : fp
1 float 12 dir X : float
1 float 16 dir Y : float
1 float 20 dir Z : float
1 float 24 limit left : outer limit
1 float 28 limit right : outer limit
1 float 32 drive left : road limit
1 float 36 drive right : road limit



limit left would be the outer collision bounds(can't drive beyond this).
drive left would be the edge of the road.

when you join points between nodes you get a line that you can test for collision with.

I haven't worked on this so someone correct me if im wrong.

LupusC
28th December 2005, 13:15
Hi ,

My question was how I get the integer coordinates for the bounds from the float values.

Messiah
28th December 2005, 15:31
Hm, I still don't get the problem :)

But I'm not sure about the bounds values.. these are maybe relatively to the node, 90° to the direction it is pointing in, while 65536 is still 1m. But don't trust on what I'm saying since I'm not 100% sure.

-wes-
28th December 2005, 15:32
in java use the float method; intValue( myint ); its in java.lang -Float.

Or do you mean convert the data into screen coordinates?

LupusC
28th December 2005, 16:06
I hope I can clarify my problem.

The centre points represent coordinates. That's fixed

1 int 0 centre X : fp
1 int 4 centre Y : fp
1 int 8 centre Z : fp

The other values are float.

1 float 12 dir X : float
1 float 16 dir Y : float
1 float 20 dir Z : float
1 float 24 limit left : outer limit
1 float 28 limit right : outer limit
1 float 32 drive left : road limit
1 float 36 drive right : road limit

But how do I get out of these float values integer coordinates like the centre coordinates.

If you connect each centre point you get the centre line of the track. But I want to display the road, so I neet the bounding points.

I hope that it's now clear.

Djizasse
19th May 2006, 10:51
Hi, I'm also trying to display a 2D image of a track. It's being made in java.
I'm having problems reading the fixed point numbers. Can you tell me how to read them?

Thanks
Djizasse

sdether
19th May 2006, 13:48
1 float 12 dir X : float
1 float 16 dir Y : float
1 float 20 dir Z : float


These three form a vector pointing in the direction that the node is "facing", i.e. that vector would point towards the next node


1 float 24 limit left : outer limit
1 float 28 limit right : outer limit
1 float 32 drive left : road limit
1 float 36 drive right : road limit


all these values are points on a line drawn through the the node perpendicular to the direction vector above.

Basically you need to do is use some trig to draw determine the vector, its perpendicular vector and then you can find the absolute coordinates of the limit and drive lines.

HTH,
sdether

Djizasse
21st May 2006, 00:54
Ok. I've been able to read those Fixed point values. They're 16/16.
Now I can draw all the path but it "overlaps" the screen, when the path goes to the edge of the screen it continues on the other side, kinda like that game worms. Is this normal or am I doing anything wrong?