I just want to do something really simple. Well it should be really simple at least.
I Have a building which can be split in several fragment, each one have their own mesh and physics. So I tried to split them using sub statobj.
The fun fact is that I'm able to have the physics for each sub objects, but I can't display the meshes.
In my mind this little piece of code, should display a sphere.cgf, but I see nothing. It's working if I set the fragmentMesh directly to the slot 0 though.
Code: Select all
SEntitySpawnParams spawnParams; spawnParams.nFlags = ENTITY_FLAG_SPAWNED | ENTITY_FLAG_PROCEDURAL | ENTITY_FLAG_CASTSHADOW; spawnParams.vPosition = Vec3(30, 30, 50); IEntity* entity = gEnv->pEntitySystem->SpawnEntity(spawnParams); IStatObj* cadastreMesh = gEnv->p3DEngine->CreateStatObj(); IStatObj* fragmentMesh = gEnv->p3DEngine->LoadStatObj("objects/sphere.cgf"); cadastreMesh->AddSubObject(fragmentMesh); entity->SetStatObj(cadastreMesh, 0, false);
So the question is basically how could I make this work?