| 1 | = Programers FAQ = |
| 2 | [[ArchivePage]] |
| 3 | [[TracNav(TracNav/TOC_Coding)]] |
| 4 | |
| 5 | |
| 6 | == General Source Questions == |
| 7 | * '''Q:''' How do I make a '''new source file''', how do I need to name it? [[br]] |
| 8 | '''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}}}. |
| 9 | * '''Q:''' How do I '''add my source file''' to the project (automake)?[[br]] |
| 10 | '''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. |
| 11 | * '''Q:''' My source doesn't get compiled altough I added it to the {{{Makefile.am}}} [[br]] |
| 12 | '''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). |
| 13 | [[br]] |
| 14 | |
| 15 | == Position & Direction == |
| 16 | |
| 17 | * '''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.[[br]] |
| 18 | '''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) |
| 19 | [[br]] |
| 20 | |
| 21 | == Collision == |
| 22 | |
| 23 | * '''Q:''' How can I enable basic collision on my objects? [[br]] |
| 24 | '''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. |
| 25 | |
| 26 | * '''Q:''' I've done everything as stated above but collidesWith does not get fired? [[br]] |
| 27 | '''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) |
| 28 | [[br]] |
| 29 | |
| 30 | |
| 31 | == Cleanup & Errors == |
| 32 | |
| 33 | * '''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?[[br]] |
| 34 | '''A:''' PNodes clean their childs on their own, this is handled by the framework. Do not delete them manually in the destructor. |
| 35 | [[br]] |