Version 2 (modified by landauf, 8 years ago) (diff) |
---|
Programers FAQ
This is an archived page! This page is very old and the content is not up to date. Not everything (if any) which is written here will be in the final game! |
General Source Questions
- Q: How do I make a new source file, how do I need to name it?
A: Just create a new file and name it the same way as the class name expect not using CamelCase but lowercase with underlines. Example: A class MyFirtsOrxonoxClass will be implemented in the files: my_first_orxonox_class.cc and defined in my_first_orxonox_class.h. - Q: How do I add my source file to the project (automake)?
A: Add the name of your source files to the Makefile.am file: there is a section that ends with SOURCES, this is where you will have to add a line for your new source file (the .cc file). The header files you will want to add to the noinst_HEADERS section. Makefiles are aranged recursively. So first look in the lowest directory (the one your source is in) if it has the _SOURCES-tag. - Q: My source doesn't get compiled altough I added it to the Makefile.am
A: If it's a header file, it won't be compiled unless it is included (by #include "name_of_the_file.h") in a source (.cc) file. If its a source file, try to make your project again by executing ./configure again (this will definilty take some time).
Position & Direction
- Q: I've used (g/s)etAbsDir() / (g/s)etRelDir() to calculate the direction I'm looking at but when I do my calculations basing on that, I get errors.
A: The naming in this case is really missleading. What it actually does is set / get the UpDir of the object, not the direction it is pointing (ie the x direction)
Collision
- Q: How can I enable basic collision on my objects?
A: Collision is handled through lists. What you need to do to use this functionality is make your class extend WorldEntity, add at least one model through loadModel and most importantly, you need to call toList() and assign it to a collision group (OM_GROUP_XX). The list of collision groups can be found in the object manager headerfile. You don't need to think about collision reaction, this part is handled internally through collision reaction handlers.
- Q: I've done everything as stated above but collidesWith does not get fired?
A: collidesWith is the deprecated collision handling within Orxonox. Sadly most classes present in its structure still use it, so you most likely have this handling function when using existing classes as template for your own classes. The new and only working way to handling collision is Hit(int damage, WorldEntity otherEntity) (see SpaceShip, the Blasters and a few other classes)
Cleanup & Errors
- Q: Since I try to manually delete the child nodes (nodes with this object as parent) I created in my PNode / WorldEntity based class, I get errors?
A: PNodes clean their childs on their own, this is handled by the framework. Do not delete them manually in the destructor.