-
Book Overview & Buying
-
Table Of Contents
CryENGINE Game Programming with C++, C#, and Lua
By :
In this section we are going to learn how to modify a static mesh at runtime, allowing for the manipulation of render and physical meshes during gameplay.
To do this, firstly we need to obtain the IStatObj instance of our object. For example, if you're modifying an entity, you can use IEntity::GetStatObj as shown:
IStatObj *pStatObj = pMyEntity->GetStatObj(0);
Note that we passed 0 as the first parameter to IEntity::GetStatObj. This is done in order to get the object with the highest
Level of Detail (LOD). This means that changes made to this static object will not be reflected in its other LODs.
You now have a pointer to an interface holding the static object data for your model.
We can now call IStatObj::GetIndexedMesh or IStatObj::GetRenderMesh. The latter is most likely the best place to start, as it is constructed from the optimized indexed mesh data as shown in the following code:
IIndexedMesh *pIndexedMesh = pStatObj->GetIndexedMesh...
Change the font size
Change margin width
Change background colour