addOctreeSceneNode dosen't work

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Stefan
Posts: 3
Joined: Sat Jul 28, 2007 8:42 am

addOctreeSceneNode dosen't work

Post by Stefan »

addOctreeSceneNode dosen't seem to work anymore.

Code: Select all

mesh = smgr->getMesh(file); // mesh is loaded correctly
sceneNode = smgr->addOctreeSceneNode(mesh);  // returns NULL
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

At revision 1145, example 02.Quake3Map works for me.

Code: Select all

	scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
	scene::ISceneNode* node = 0;
	
	if (mesh)
		node = smgr->addOctTreeSceneNode(mesh->getMesh(0), 0, -1, 128);
Does it work for you?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Stefan
Posts: 3
Joined: Sat Jul 28, 2007 8:42 am

Post by Stefan »

this example works...
however, if I use

Code: Select all

node = smgr->addOctTreeSceneNode(mesh, 0, -1, 128); 
instead of

Code: Select all

node = smgr->addOctTreeSceneNode(mesh->getMesh(0) , 0, -1, 128); 
it dosen't work for my .x model.
With "20kdm2.bsp" it still works...

btw, the mesh returned by mesh->getMesh(0) seems to be wrong with some meshes.
joshcryer
Posts: 46
Joined: Thu Sep 13, 2007 8:57 am
Contact:

Post by joshcryer »

There's definitely some funky stuff going on in there but I'm hesitant to post a bug report. For instance, I in particular have to do myAMesh->getMesh(0) on a certain .x file I have for it to be in the right orientation. Just don't have the energy to write up a bug report right now though and I don't even know if it's Irrlicht or Blender for that matter. I was told long ago to use AnimatedMeshes for everything in any case.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Stefan wrote:this example works...
however, if I use

Code: Select all

node = smgr->addOctTreeSceneNode(mesh, 0, -1, 128); 
instead of

Code: Select all

node = smgr->addOctTreeSceneNode(mesh->getMesh(0) , 0, -1, 128); 
it dosen't work for my .x model.
With "20kdm2.bsp" it still works...
Since addOctTreeSceneNode(IAnimatedMesh* mesh, ...) just calls addOctTreeSceneNode(IMesh* mesh, ...) using mesh->getMesh(0), I find that a little hard to understand.
Stefan wrote:btw, the mesh returned by mesh->getMesh(0) seems to be wrong with some meshes.
KHAAAAAAAAAAAAAAN!

Er, I mean: LUUUUUUUUUUUUKE!
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

same problem
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I'm guessing this is the known bug with SkinnedMesh, please post your mesh to be sure. There needs to be two ways of loading a B3d/X/MS3D mesh that doesn't contain animation data.
Either-
a) You want to treat it like an animated mesh and move its bones around (ie ragdoll)
b) You want it completely static and to ignore all bones (ie level)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

yeah this is a hard one

I'll look into it, thanks for the link rogerborg

for now, can you try the quick fix: (let me know if it doesn't work, it hasn't been tested and it is 4am...)

Code: Select all

void FixStatic(IAnimatedMesh *Mesh)
{
	if (Mesh->getMeshType()!=EAMT_SKINNED)
		return;

	for (u32 n=0;n<Mesh->getMeshBufferCount();++n)
	{
		SSkinMeshBuffer *Buffer=(SSkinMeshBuffer*) Mesh->getMeshBuffer(n);

		for (u32 i=0;i<Buffer->getVertexCount();++i)
		{
			Buffer->Transformation.transformVect(Buffer->getVertex(i)->Pos);
		}

		Buffer->Transformation.makeIdentity();
	}
}
Chmel_Tolstiy
Posts: 41
Joined: Mon Feb 11, 2008 3:06 pm

Post by Chmel_Tolstiy »

As I understand this code doesn't rotate vertex normals. Am I right ?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Ah yes, you'll need to add rotateVect(Buffer->getVertex(i)->Normal)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Chmel_Tolstiy
Posts: 41
Joined: Mon Feb 11, 2008 3:06 pm

Post by Chmel_Tolstiy »

bitplane wrote:Ah yes, you'll need to add rotateVect(Buffer->getVertex(i)->Normal)
now it's ok. thanks.
Post Reply