Tips
Using Callbacks
- When using a Callback, make sure that before deleting the scheduler and timer, to first unsubscribe the timer. The order of operation should be as follows:
scheduler->unScheduleTimer(timer); //unschedule the timer delete timer; //delete the timer delete scheduler; //delete the callback
Using the Collision Detection System
- Make sure that the Broad Phase Boundary volume is set adequately. If your model serves as a floor, then set it as a Platform, else set it as a Sphere. If you do not do this, the engine will not have enough time to compute the proper Collision Normal. To set an entity as a platform, use the following method U4DEngine::
U4DStaticModel:: initAsPlatform.
Here is an example:
//Set the island as a platform island->initAsPlatform(true);
- When using disproportionate size objects, keep in mind the following
- The maximum width and length of the entity serving as a terrain is 10x10 units
- The minimum depth of the terrain object should be twice as deep as the colliding entity.
- The colliding objects should be low-poly as much as possible. Too many vertices will slow down the engine while it tries to compute the proper Collision Maniforlds.
The collision filters work as follows:
-Collision Categories means: I am of type... -Collision Masks means: I collide with...
The collision group index, follows the following rule:
-if either fixture has a groupIndex of zero, use the category/mask rules as above -if both groupIndex values are non-zero but different, use the category/mask rules as above -if both groupIndex values are the same and positive, collide -if both groupIndex values are the same and negative, don't collide
- When using the Collision filters. The categories must be defined as bitflags, i.e. 0x0002, 0x0004, 0x0008, 0x0010 etc. The group index must be defined as signed integers.
Using textures
- Use TinyPNG to compress your images. Using large images affects the engine.
Running the Digital Asset Exporter (DAE)
- Make sure that the objects selected are in object mode. The script will not run if the models are in Pose mode.
Creating a new project
- Make sure the Objective-C Automatic Reference Counting is set to No
Creating Skyboxes
- All skyboxes images need to be inverted verticaly. The images representing top and bottom must be rotate 180 degress and then inverted vertically.
Removing an entity from a game
Removing an entity from the scenegraph should be done as follows
U4DEngine::U4DEntity *parent=getParent(); //Get the entities parent parent->removeChild(this); //remove the entity