Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VDrift coordinate system
01-10-2010, 01:14 PM,
VDrift coordinate system
I've been thinking about moving the track editor functionality into blender. But I am somewhat irritated by the coordinate transforms.
A vertex(parkinglot track) in blender (-15, 179, 4.5) has the following coordinates in the track editor (179, 4.5, -15) :o

This means a 90° rotation around x-axis followed by 90° around z-axis?
01-13-2010, 06:36 PM,
I had a look at the code. So we have:

pos.Set(f3[2], f3[0], f3[1]);
QUATERNION <float> orient(f3[2], f3[0], f3[1], f1);

So what do we have here take position xyz from start position and load it as zxy. The same happens to the orientation.

bool CAR::Load
//due to historical reasons the initial orientation places the car faces the wrong way
dynamics.SetInitialConditions(initial_position, fixer*initial_orientation);

Load applies a 180 degrees rotation to the orientation around z-axis.

void CAR::CopyPhysicsResultsIntoDisplay()
quat = dynamics.GetOrientation();
fixer.Rotate(-3.141593*0.5, 0, 0, 1);

The orientation is updated by the physics multiplied with a -90 degrees rotation around z-axis(the fixer again).

Well, I've got a track export plugin which allows to do the complete track setup/creation within blender. But not being able to reproduce this orientation transforms in the plugin it returns incorrect orientations.

PS: My test track for the track exporter Tongue
[Image: test10v7gi.jpg]
[Image: testxs5f3.jpg]
01-14-2010, 11:30 PM,
Ooh, rainbow road! :-) That's got to be a hard track to drive on.

The transforms are crazy. Sorry about that. When I rewrote everything I had to keep the insanity intact to avoid changing the data. I went back and fixed the car coordinate system:
but haven't fixed the track coordinate system.

Anyway, it sounds like you have it figured out now. Are you still having trouble reproducing the orientation? One option would be to change the track orientations to match blender like I did with the .car file. I've actually been meaning to rewrite the track file format and combine the track.txt and list.txt and surfaces.txt and so on into one file.
01-15-2010, 03:41 PM,
i really like that track.. alot!

supertuxkart.sourcefourge would probably really like that track too.

for their kart game, you should check it out
01-15-2010, 04:04 PM,
Yeah, the track is a homage to Mario Kart 64. Big Grin
01-29-2010, 06:25 AM,
Hey Joe

I had a look at some of the track JPKs in blender. They have z-axis as up-axis. So the coordinate system transforms affect roads.trk, track.txt only?
I could write a tiny script to fix the coordinate transforms in this files.

Or we change the track file format now. Joining track.txt and surfaces.txt and roads.trk. (I am almost done with the import/export trk scripts.)
02-01-2010, 11:02 PM,
So, what's the coordinate system now, and what's the desired coordinate system? Is the desired coordinate system the opengl coordinate system that VDrift uses to render stuff (Y=up)? Or is the desired cooridnate system the blender coordinate system (Z=up)?
02-02-2010, 04:25 PM,
Personally, I would prefer the opengl(Y=up) orientation to get rid of the fix rotations in the code. I would modify the importer/exporter scripts and update the JOEs and JPKs. We would lose compatibility to old data. This could cause confusion among users/contributors Sad
02-04-2010, 11:25 AM,
Maybe increment the version counter on the .joe files, process them to change their rotations to the Y=up coordinate system, then (at runtime) if it's the old version, apply the rotation fix, if not, don't. Eventually once there are a couple of releases out with the newer coordinate system support, remove support for the old. What do you think?
02-04-2010, 04:56 PM,
Sounds good. So the next step is moving the rotation fixes into the joe loading code?
02-05-2010, 11:23 AM,
Yeah, that sounds good.

Forum Jump:

Users browsing this thread: 1 Guest(s)