Be careful when dealing with C++ floating point.

Look at this piece of code: Vector3 colPlaneNor; float dx = abs(aabb1->getPosition().x() – aabb2->getPosition().x()); float dy = abs(aabb1->getPosition().y() – aabb2->getPosition().y()); if(dx < (aabb1->_width + obb2->_width)/2.0f)     colPlaneNor = Vector3::UNIT_Y; else if(dy < (aabb1->_height + aabb2->_height)/2.0f)     colPlaneNor = Vector3::UNIT_X; The idea of these lines of code is to determine the collision plane normal when two …

Continue reading

Figuring out Moai input

Sample can be referred: moai-sdk/sample/input/ As far as I can see, there is a input manager: MOAIInputMgr, to handle cross platform input. It seems its member MOAIInputMgr.device handle with different plat form, like in PC, there is MOAIInputMgr.device.mouseLeft, and in mobile device, it is MOAIInputMgr.device.touch. Also, there is MOAITouchSensor can …

Continue reading