WpfModelVisual3DNode not following its parent
When I parent a WpfModelVisual3DNode to a scene node, it doesn't seem to "follow" when the parent's transform is changed.

I've an empty SceneNode object with two children. A cylinder MeshObjectNode which renders fine and a WpfModelVisual3DNode node which also renders fine. But when I move the SceneNode, the cylinder mesh inherits the transform, but the WpfModelVisual3DNode doesn't inherit the transform.

If I delete the WpfModelVisual3DNode node and re-create it it appears in the correct place, but I shouldn't have to do this. Is this a known bug?

I'm rendering a DXScene directly. I have a DXViewportView instantiated to ensure the text node renders, but does this have something to do with the problem?

When you change a transformation of a SceneNode, you need to notify all SceneNode parents and all its children about that change.

This is done with the following code:

// Because our transformation has changed, parent SceneNodes should update their bouding boxes                
// Also notify all child nodes that they need to update the world matrix

When you use WPF 3D objects like BoxVisual3D or other Visual3D objects, those notifications are done automatically by the WpfModelVisual3DNode that represents the ModelVisual3D objects in the DXEngine's SceneNode hierarchy.

But when you use SceneNodes directly, you need to notify the "interested" SceneNodes manually. Also when you change a setting in a DXEngine's material you need to notify the SceneNodes that use that material about the material change: NotifySceneNodeChange(SceneNodeDirtyFlags.MaterialChanged)
Andrej Benedik

Forum Jump:

Users browsing this thread:
1 Guest(s)