Storyboard Rotation stops work...

Jun 24, 2010 at 1:06 AM

Hi, i've tried to change the vertex of a box and then the rotation  "(Node.Rotation).(Y) stop working...


Jun 24, 2010 at 6:51 AM

Interesting - to say the least. 

In the interest of reproduction, how do you change the vertex?  By changing the vertex directly through the GeometryContext/GeometryDetailLevel ? 

Jun 24, 2010 at 12:40 PM

Yes...using the GeometryDetailLevell

mesh case:

     IAssetPart[] nd = _mesh.GetAssetParts(); ;
    Geometry gd = (Geometry)nd[0];
    IGeometryContext gc = gd.GeometryContext;

    var geometryDetailLevel = gc.GetDetailLevel(DetailLevel.Full);

    Vertices = geometryDetailLevel.GetVertices();

 Geometry case:

   IGeometryContext gc = _geo.GeometryContext;
   geometryDetailLevel = gc.GetDetailLevel(DetailLevel.Full);
   Vertices = geometryDetailLevel.GetVertices();


Then, to set the vertex:

                Vertex vt = Vertices[vv];
                vt.X += deltaVertices[vv].X;
                vt.Y += deltaVertices[vv].Y;
                vt.Z += deltaVertices[vv].Z;
                geometryDetailLevel.SetVertex(vv, vt);


But i tried:

                mshMorph = new Box();
                mshMorph.Material = (Material)Application.Current.Resources["morphMaterial"];
                mshMorph.IsVisible = true;
                mshMorph.Dimension = new Coordinate(75, 100, 80);
                mshMorph.Position = new Coordinate(-280, -20, 90);
                mshMorph.Rotation = new Coordinate(0, 0, 0);
                mshMorph.Scale = new Coordinate(1, 1, 1);

but i got null in mshMorph.GeometryContext;


Do i need to set any other property or call Box.Prepare()?


Jun 24, 2010 at 6:40 PM

I gave it a go by just creating the Box and it has the GeometryContext. When are you creating it, in the OnLoadContent() of the Game, or earlier? Could be an initialization thing I'm missing. 

But, the Prepare() method as you point out is the one creating the box - it could be called manually I guess, but that could break your code in the future. The safest place to start modifying the mesh, is in the OnUpdate() event of the Game - then everything should be ready for rendering. I see that the need for VertexModifiers are starting to be more and more clear.