Import collada file with scaled object from blender

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
Post Reply
sanjuda
Posts: 7
Joined: Tue Jul 14, 2009 10:03 am

Import collada file with scaled object from blender

Post by sanjuda »

Dear all,
I spent the morning trying to figure out what was happening importing some scene built with blender and exported through collada.
I built something like a billiard table in blender exported it in collada 1.4 and I had that the balls go through the table when the scene is imported in collada demo with bullet-2.75-rc7.
I found that the problem happens when the plane is scaled and the matrix in the corresponding node of the <library_visual_scenes> has the diagonal with values different from 1..

I've looked around for similar issues but i found only http://www.bulletphysics.com/Bullet/php ... =12&t=1811

Looking for collada and matrix <library_visual_scenes> around in the web I didn't undrestand if the file created by the blender collada exporter is wrong or if it is a problem of bullet importer.

What I've seen is that if the dae file contains something like:

Code: Select all

<library_visual_scenes>
		<visual_scene id="Scene" name="Scene">
			<node layer="L1" id="Plane_003" name="Plane_003">
				<matrix>
					4.205 0.0 0.0 3.94544 
					0.0 4.205 0.0 0.30043 
					0.0 0.0 4.205 6.76338 
					0.0 0.0 0.0 1.0 
				</matrix>
				<instance_geometry url="#Plane_009"/>
			</node>

the related node will not be used correctly for collisions while

Code: Select all

<library_visual_scenes>
		<visual_scene id="Scene" name="Scene">
			<node layer="L1" id="Plane_003" name="Plane_003">
				<matrix>
					1 0.0 0.0 3.94544 
					0.0 1 0.0 1.60043 
					0.0 0.0 1 6.76338 
					0.0 0.0 0.0 1.0 
				</matrix>
				<instance_geometry url="#Plane_009"/>
			</node>
will work...

however blender usually generates code of the first type..
what should one do?
write a script to apply transformantion on the file before of feeding bullet? (so this time I'll learn python.. I'm getting old to learn things.. it is better that robots learn instead of me)
Post Reply