Changning Model at Runtime

Jan 27, 2011 at 2:10 PM
Edited Jan 28, 2011 at 12:49 PM

First of all sorry, for this maybe rather simple question.
But as a Coding Newbi i've been having problems with Changing the Model at Runtime.

Im making a small App, that shows different models at different times, in Code-Behind with the Game Class.
I've been trying to change the Mesh on "OnBeforeUpdate()" and in "OnUpdate()".
With code like.

EDIT: Forgot to Add this is in Silverlight 4.

Scene.RemoveNode(_model);
Scene.Clear();

_model = new Mesh();
_model = ContentManager.Load<Mesh>("model.ase");

_model.Position.Y = -4;
_model.Scale = new Balder.Math.Coordinate(1.2, 1.2, 1.2);       

Scene.AddNode(_model);

 

And alot of other solutions has been tried, but every time i've been meet with
"Value does not fall within the expected range."

Im sure the solution could be found in some of the Source material, but I've found it a tad to complex for me to handle.
So in conclusion i would just like to ask, if someone has a solution i could use?

Anyways Thank you, and thumps up for making Balder 3D im enjoying it very much.

Best Regards
Christian Kristensen

Jan 28, 2011 at 1:53 PM

Solution has been found...
Apperntly it didn't like me using a User Control to show a Game, and then use it from a Game Class that borrowed from Balder.Execution.Game.

Making a Game in Xmal and using it from Code-Behind seems to work.