Re: Run-time vegetation editing.

#2
Ok, I figured out the way to spawn new foliage and remove existing, but I'm still not sure it is correct.
Does foliage IRenderNode::GetStatObjGroupId returns id that correspond editor foliage type, first row type 1 second 2 and so on? Or is there any other way to get foliage type?

Code: Select all

//Raycast stuff here
//Spawn a new vegetation object instance.
IRenderNode* spawntedTree = gEnv->p3DEngine->GetITerrain()->AddVegetationInstance(0, hit.pt, 1, 1, 0);
//Destroy foliage object instance
if (hit.pCollider->GetiForeignData() == PHYS_FOREIGN_ID_STATIC) {
void* fData = hit.pCollider->GetForeignData(PHYS_FOREIGN_ID_STATIC);
IRenderNode* pRN = static_cast<IRenderNode*>(fData);
if (pRN->GetRenderNodeType() == EERType::eERType_Vegetation) {
//Theoriticaly foliage type.
int vegType = pRN->GetStatObjGroupId();
gEnv->p3DEngine->DeleteRenderNode(pRN);
}
}

Re: Run-time vegetation editing.

#3
These should be the unique variants of your vegetation objects.
You should be able to get more detail via the following function;

Code: Select all

bool C3DEngine::GetStatInstGroup(int nGroupId, IStatInstGroup& siGroup)
nGroupId would correspond to your vegType variable.
Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Re: Run-time vegetation editing.

#4
Thanks! Maybe there is a way to get all vegetation in the level? I have some issues with TI, due to the fact that vegetation is considered as static geometry and editing it in the game leaves obsolete gi effects.
I thought I can serialize it in the editor and later spawn it on my own with changing GI mode to dynamic voxelization (https://imgur.com/a/isuNgqC). I'm also planning to use that vegeatation list to synchronize it over the network.

Who is online

Users browsing this forum: No registered users and 4 guests

cron