Change the transform of a child object
OBJ files do not support model transformations. Therefore your model (and its sub-parts) were loaded without any transformation.

But all WPF 3D objects have a Transform property that you can use to animate your object.

For example if you have the following structure:

1x GeometryModel3D ("CarBody")
4x GeometryModel3D ("CarWheels")

You can set TranslateTransform3D to the Model3DGroup's Transform to move the car.
You can set RotateTransform3D to wheels GeometryModel3D to rotate the wheels - you can use the AxisAngleRotation3D object for rotation - it takes a rotation axis and an angle.

Note that if your OBJ file sets names for models, you can get the objects by names with using the ReaderObj's NamedObjects dictionary (Dictionary<string, Model3D>) - for example:

var objImporter = new Ab3d.ReaderObj();
var wpf3DModel = objImporter.ReadModel3D("fileName.obj");

var leftWheel = objImporter.NamedObjects["LeftWheel"] as GeometryModel3D;
Andrej Benedik

Messages In This Thread
RE: Change the transform of a child object - by abenedik - 04-06-2016, 10:58 PM

Forum Jump:

Users browsing this thread:
1 Guest(s)