AB4D Forum

Full Version: Moving and Efficient creation of SceneNodes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have to create an scene with many independent meshes. I am using MeshObjectNode to create the SceneNode that are all appended to one root SceneNode. First of all I am not sure if this is the most efficient way of creating the objects, having one root scene node and then appending all of the different object's meshobjectnode.

Secondly, I would like to move each of the objects independently, but I am not sure how. I have seen in the examples that in order to move them all the examples use the SceneNodeVisual3D and then the transform of this object is changed. As far as I understand the SceneNodeVisual3D is a wpf object which is less efficient since I want to work directly with MeshObjectNode.

I have tried changing the Transform of the children SceneNodes but that does not move the mesh defined within the SceneNode. Am I missing anything?
You can change the transformation of SceneNodes with setting the Transform property. After that change, you also need to call NotifySceneNodeChange method on the changed SceneNode.

For example:
var transformMatrix = Matrix.Scaling(1, _orangePyramidYScale, 1) *
                      Matrix.RotationY(MathUtil.DegreesToRadians(_orangePyramidYRotate)) *
                      Matrix.Translation(0, -_orangePyramidYRotate, 0);

_orangePyramidObjectNode.Transform = new Transformation(ref transformMatrix);

// When the Transform is already set, you can change the matrix by:


I have updated the ManuallyCreatedSceneNodes sample with sample code that shows how to change transformation.
You can check the new content of the files on the sample project on GitHub:
awesome thanks! i'll be back... hahaha