Scale based mesh parenting using Transform3DGroup

Oct 31, 2012 at 2:49 PM
Edited Oct 31, 2012 at 2:53 PM

I want to move black mesh relative to the green mesh as shown in the attached image below. I want to make green mesh parent to the black mesh as the change in scale of the green mesh also will result in motion of the black mesh. It could be partial parenting or may be more. I need 3D rotation and 3D transition + transition along green mesh's length axis for the black mesh, relative to the green mesh itself.
Suppose a variable green_mesh_scale causing scale for the green mesh along its length axis. The black mesh will use that variable in order to move along green mesh's length axis.
How to go about it further?

Image: In image black mesh is moving relative to the change in scale of the green mesh.

I've done as follows:

GeometryModel3D GreenMesh, BlackMesh;

// ...

double green_mesh_scale = e.NewValue;

Transform3DGroup forGreen = new Transform3DGroup();

Transform3DGroup forBlack = new Transform3DGroup();

forGreen.Children.Add(new ScaleTransform3D(new Vector3D(1, green_mesh_scale , 1)));

// ... transforms for rotation n transition

GreenMesh.Transform = forGreen ;

forBlack = forGreen;

forBlack.Children.Add(new TranslateTransform3D(new Vector3D(0, green_mesh_scale, 0)));

BlackMesh.Transform = forBlack;

The problem with this is the scale transform will also be applied to the black mesh. I think i just need to avoid the scale part.
I tried keeping all the transforms but scale, on another Transform3DGroup variable but that also not behaving as expected.
Can MatrixTransform3D be used here some how?

Coordinator
Nov 2, 2012 at 10:31 PM

maybe you should try Stack overflow for this? I don't see any features from this library used here... :)