Was wondering if we could change the drawDebugData method to show sensors as a different color than the other shapes. I have them shown as yellow in my copy and it definitely helps.
Code:
if (b.isStatic()) {
drawShape(s, xf, new Color3f(255f*0.5f, 255f*0.9f, 255f*0.5f), core);
} else if (b.isSleeping()) {
drawShape(s, xf, new Color3f(255f*0.5f, 255f*0.5f, 255f*0.9f), core);
} else {
drawShape(s, xf, new Color3f(255f*0.9f, 255f*0.9f, 255f*0.9f), core);
}
// to
if (b.isStatic()) {
drawShape(s, xf, CLR_STATIC, core);
} else if (b.isSleeping()) {
drawShape(s, xf, CLR_SLEEPING, core);
} else if (s.isSensor()) {
drawShape(s, xf, CLR_SENSOR, core);
} else {
drawShape(s, xf, CLR_DYNAMIC, core);
}
// where
private static final Color3f CLR_SENSOR = new Color3f(255f, 255f, 255f*0.5f); // Yellow
private static final Color3f CLR_STATIC = new Color3f(255f*0.5f, 255f*0.9f, 255f*0.5f); // Green
private static final Color3f CLR_SLEEPING = new Color3f(255f*0.5f, 255f*0.5f, 255f*0.9f);// Blue
private static final Color3f CLR_DYNAMIC = new Color3f(255f*0.9f, 255f*0.9f, 255f*0.9f);// Grey
Along the line of optimizations, I see there are quite a few places where constants could be used. For example, you create a new instance of the Color3f for every shape, every time, which also involves 3 multiplications. Not sure if there is compiler or runtime optimization of that, but never hurts to be more explicit (also easier to find them later).