hi,
this maybe is a "simple" problem but i'ts ripping my nervs apart. i started developing yesterday night and managed to render a scene with a player object, this object is similar to tutorial21. it worked yesterday night ( 4 am) and i tried just a minute ago. and it crashes @ Haddd.Begin() with the exception "No existe el objecto mesh". Due to the not available source it is not possible to debug through it. i wonder why it throws the "mesh object not exists" because i only use HMesh.CreateShpereand this copied from the tutorial.
any hints would help
thnx mauzi the Dude
you have a HMeshObject without a HMesh assigned.
Look at: Sphere.Mesh=mesh;
thnx for the quick reply
the mesh is assigned and no other mesh is used :
player constructor ( no other methods used for creation )
public Player(string n, Vector3 pos) : base(n) {
// this is just for testing -> ResourceData.getEntityFromXml("asdf", "asdf")
// setup mesh and obj
meshObj = Haddd.Scene.MeshObjects.Create(n);
HMesh m = HMesh.CreateSphere(0.5f, 20, 20);
meshObj.Mesh = m;
// setup materials
// setup camera
camera = (HCameraFirstPerson)Haddd.Scene.Camera;
camera.UseInput = false;
camera.Position = new Vector3(0, 0, 0);
camera.OnlyTranslationOnParent = true;
meshObj.AddChild(Haddd.Scene.Camera);
//meshObj.AddChild(camera);
HCollision col = new HCollision();
col.CreateConvexHull(meshObj.Mesh.ArrayOfVertices());
col.ComputerInertia();
body = Haddd.Physics.RigidBodies.Create(col, meshObj);
body.Mass = 1f;
Matrix mat = Matrix.Translation(pos);
body.Matrix = mat;
HUpVectorJoint j = new HUpVectorJoint(new Vector3(0, 1, 0), body);
col.Release();
}
InitGame method public override bool InitGame(System.Windows.Forms.Form form) {
try {
Haddd.AfterCreateDevice();
Haddd.LoadCreateInHouse();
Haddd.Physics.Create();
// set scene vars and run engine
// todo
Haddd.Scene.SkyBox = new HSkyBox("lobbycube");
player = new Player("player", new Microsoft.DirectX.Vector3(0, 10, 0));
Haddd.Begin();
Haddd.CreateInput();
return true;
}
catch (Exception e) {
System.Windows.Forms.MessageBox.Show(e.Message);
return false;
}
}
SOLVED,
sorry, it seemed it wasn't fully up when posting :rolleyes:
i initialized the player object AFTER Haddd.Begin() and it seems to work alright ;)
sorry once more.