AB4D Forum

Full Version: how to parent Objects to another?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

So ive got this hand made in blender3d that I was able to export to an obj file. Ive also been able to replace the controllers with those hands. The problem is that this hand has 17 objects separated from each other. Inside the ab3d engine they are loaded as 1 object. Is it possible to access each one of those objects Inside the imported full mesh and rotate them. basically i want to rotate each individual joints to be able to link them to the primary or secondary hand trigger axis of the touch controller.

thank you
nine


[Image: http://i63.tinypic.com/2wmdy1i.jpg]
NOTE: This post was moved from Ab3d.DXEngine section to Ab3d.PowerToys section.

The problem is that the obj file format does not support hierarchies. This means that when you have exported your hand model each part of the model is exported without any connection to the other parts.

To make your model work, you will first need to export to some other file format.
1) You can use 3ds and then read the file with Ab3d.Reader3ds - this is a commercial 3ds file reader from AB4D.
2) You can export to fbx or dae (Collada) and then use the Assimp importer. See the Ab3d.PowerToys samples and "Ab3d.PowerToys.Assimp.chm" help file (by default installed into the Program Files\Ab3d.PowerToys folder). This option is free, but will require a little bit more work with your project to make sure that the required native libraries are installed (see help and sample project).

After that you will be able to get the 3d model into your application with the object's hierarchy.

3D object's hierarchy in WPF is created with using Model3DGroup object that define Children properties - child objects can be another Model3DGroup or GeometryModel3D (defines the 3D objects with MeshGeometry3D and Material that is shown). 

Both Model3DGroup and GeometryModel3D are derived from Model3D object - that object defines Transform property that defined the transformation of the Model3D. In case of Model3DGroup this transformation transforms all the objects defined in the Children collection.

This way you can move the parent Model3DGroup with changing its Transformation (for example TranslateTransform3D) and this will also change all the child objects.


Model3D objects do not define Name property. So after you read the model from 3D file, you would not be able to find the object by its name (as defined in 3D modelling application). To solve this problem both Reader3ds and AssimpImporter (and also ReaderObj) define NamedObjects dictionary - this defines object names as keys and objects as values. This way you can access the objects by its name - note that reader can add "_Group" or some other prefixes or suffixes to the names.

To get the list of names and the hierachiy of the read objects, it is best to put a breakpoint to a line after the 3d model is read and when the application is sopped at the breakpoint, open Immediate Window in Visual Studio and type myReadModel.DumpHierarchy()   (replace "myRadeModel" with the name of your object that holds the read object). DumpHierarchy is an extension method from Ab3d.PowerToys and is defined for Viewport3D, Visual3D and Model3D.

Btw: Ab3d.PowerToys also define GetName and SetName extension methods on Visual3D and Model3D that allows you to set and get names to Visual3D and Model3D objects (SetName is also used by file readers).


I hope that this will help you animate your hands.