Storyboard Rotation stops work...

Jun 24, 2010 at 12:06 AM

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

Thx...

Coordinator
Jun 24, 2010 at 5: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 11:40 AM

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);
                _game.Scene.AddNode(mshMorph);

but i got null in mshMorph.GeometryContext;

 

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

 

Coordinator
Jun 24, 2010 at 5: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.