help with world matrix

Hi,
I’ve been working on fixing up some problems in the md3 exporter script as described in the following thread:

https://blenderartists.org/forum/viewtopic.php?t=32199

The main area of change is in the tags. The tags were previously not written out correctly. After a few small changes, any selected empties are now written out as md3 tags. The problem I have is that a tag consists of an origin along with an x, y and z axis (rather than a normal vector). When I look at the output (I wrote a little md3 disassembler), the x, y and z axes are all identical. The script and also the viewer is in the zip file below.

http://www.ijbrown.net/blender/qtools.zip

I figure that it must be something to do with my understanding of blender’s coordinate system. The code snippet that initialises the tag structure looks as follows:


	for fr in range(1, NUM_FRAMES+1):
		Blender.Set("curframe", fr)
		for tag in tag_list:
			t = md3_tag()
			matrix = tag.getMatrix('worldspace')
			for i in range(0,3):
				t.axis[0].co[i] = matrix[0][i]
				t.axis[1].co[i] = matrix[1][i]
				t.axis[2].co[i] = matrix[2][i]
				t.origin.co[i] = matrix[3][i]
			t.name = tag.name
			md3.tags.append(t)

The end result would appear to be that t.axis[0] == t.axis[1] == t.axis[2]
which isn’t what I want. I need t.axis[0] to be the local x-axis, t.axis[1] to be the local y-axis etc.

Can someone please help. Without working tag support, the md3 exporter cannot be used for player models because the tags are necessary to align the various bits of the player (head, torso, legs and weapon).

Ian

Hi,

perhaps change the title to include a mention of md3 export. Also you can email the bf-python list if you don’t get an answer here.

LetterRip

…that code works good for me.I got
t.axis[0] = [1.0, 0.0, 0.0]
t.axis[1] = [0.0, 1.0, 0.0]
t.axis[2] = [0.0, 0.0, 1.0]
and the origin different for every frame in a simple
animation(without rotation) of a cube.
Ben

Ah - maybe the trouble is on my side of the keyboard then :slight_smile: I’ll take another look into it. Thanks for the sanity check.

Ian