我用boundingBox()函数进行碰撞检测,如果矩形区域发生旋转,就是识别不准确,有没有函数获得精灵旋转后的矩形区域,并进行碰撞检测的?
参考最新Sprite代码
kmMat4 worldTM = getNodeToWorldTransform();
//generate aabb
//
// calculate the Quad based on the Affine Matrix
//
Rect newRect = RectApplyTransform(_rect, worldTM);
kmVec3 point = {newRect.getMinX(), newRect.getMinY(), _vertexZ};
AABB aabb(point,point);
kmVec3Fill(&point,newRect.getMaxX(), newRect.getMinY(), _vertexZ);
aabb.expand(point);
kmVec3Fill(&point,newRect.getMinX(), newRect.getMaxY(), _vertexZ);
aabb.expand(point);
kmVec3Fill(&point,newRect.getMaxX(), newRect.getMaxY(), _vertexZ);
aabb.expand(point);