Collada convexHullShape

Rob2687
Posts: 5
Joined: Sat Jun 28, 2008 12:25 am

Collada convexHullShape

Post by Rob2687 »

Does the Collada converter support convex hull shapes?
I am considering using this format for exporting physics and model data. I have tried exporting static triangle meshes from Blender and it works okay but convex hulls don't seem to work. When open the Collada file with the demo it just says "No Triangles or Polygons found in ConvexMesh Geometry".
Rob2687
Posts: 5
Joined: Sat Jun 28, 2008 12:25 am

Re: Collada convexHullShape

Post by Rob2687 »

Turns out it is a bug in the Blender exporter.

See here for reference:
http://projects.blender.org/tracker/ind ... 9&atid=125

and just in case anyone else comes across this issue.
Blender 2.45 and 2.46 tested, both had the problem.
svn-version not tested.

How to reproduce:
Create torus (or some other mesh)
Make it an actor, dynamic and rigid body.
Set "convex hull polytope" for bounds.

Export to Collada 1.4

In the exported dae-file there will be among other things a <library_geometries> with the exported geometries.
The convex hull polytope results in:

<geometry id="Torus-ConvexGeom" name="Torus-ConvexGeom">
<convex_mesh convex_hull_of="Torus-Geometry"/>
</geometry>

Which is that the importer should read the referenced url of another geometry (in this case the visual torus mesh) and
compute a convex hull to use for collision detection. The Torus-Geometry is available in the same library_geometries
and the url should point to something that's local. The convex_mesh tag should therefor instead look like:

<convex_mesh convex_hull_of="#Torus-Geometry"/>

For reference, see
COLLADA, Digital Asset Schema Release 1.4.1,
Specification – COLLADA Physics, 5-6, 5-7

http://www.khronos.org/files/collada_spec_1_4.pdf
Date: 2008-05-23 00:24
Sender: Mattias Linde

Suggested fix:

Index: release/scripts/bpymodules/colladaImEx/collada.py
=================================================================
==
--- release/scripts/bpymodules/colladaImEx/collada.py (revision
14932)
+++ release/scripts/bpymodules/colladaImEx/collada.py (working
copy)
@@ -762,7 +762,7 @@

def SaveToXml(self, daeDocument):
node = super(DaeConvexMesh,
self).SaveToXml(daeDocument)
- SetAttribute(node, DaeSyntax.CONVEX_HULL_OF,
StripString(self.convexHullOf))
+ SetAttribute(node, DaeSyntax.CONVEX_HULL_OF,
StripString('#'+self.convexHullOf))
return node

class DaeMesh(DaeEntity):