Creating a flexible character/entity model class

Started by
1 comment, last by Dalek 19 years, 6 months ago
These may be silly questions but: I am currently working on a simple 3D engine - and I have a couple of questions regarding implementation. With regards to world entities (i.e. trees, characters etc), what would be the best way to store the entities position and orientation information, similar to a vector based camera? i.e. up, facing, right vectors? Also - is it normal to have a model/mesh class responsible for loading its own textures and meshes, or would it be appropriate to design a texture/mesh manager that will load the appropriate data then create a series of objects based on the requirements specified in a config file? Thanks! :)
Advertisement
Well the way other engines do it, well for the storing of the co-oridates part, is that everything is basically a node.
So what you could have is many sub nodes that all inherit from the base node. And it will be the base node that stores the co-oords;

In the base node, you can have private variable like:

vector3d position;
vector3d rotation;
vector3d scale;

Then you just pass stuff into them.

As for the textures, you can do both. If it is a model file, then you can make it automatically make it load the textures that are associated with the model. Regardless of what you do though, you will have to have a texture class. Thats if the engine is OO.

I would think its better to just write a texture loader and let the users manage their own loading. For example, you may want to, for your game, load all textures at startup or you may want to load them as you encounter such parts that need them.

If you are making an engine you must focus on engine features. Of course you must think of how a game would use them but you need the low level stuff first. Then you can write utility methods to use help out.

Hope this helps




The ability to succeed is the ability to adapt
Yes thanks it does. Its a challenge sometimes thinking of these things generically - but of course it will help in the long run. Okay, thanks :)

This topic is closed to new replies.

Advertisement