cocostudio的骨骼动画编辑能添加物理碰撞机制吗?

如题。如果可以,怎么添加?否则,怎么实现碰撞检测呢?
各位大神,求指教!!先谢过了

你好,CocoStudio动画编辑器提供的骨骼动画的碰撞区编辑功能,但是碰撞检测仍然是交给物理引擎的。编辑器导出的是一个形状的列表,你可以通过getshapelist()方法获取并传递给物理引擎。

谢谢版主:14:,我在cocostudio的动画编辑器中找不到碰撞区的检测功能啊?我使用的版本是1.3.0.0

这个可以在菜单栏的窗口中打开“资源编辑窗口”。默认没有显示。

版主,你好,我试了用CCArmature对象去调用getshapelist()这个方法,但是出现错误说,不存在这个成员函数,我使用的是2.2.3的版本,求解惑

跟你一样的情况,我找了一下cocostudio中CCArmature.h中的定义,发现需要#define ENABLE_PHYSICS_BOX2D_DETECT 0改为#define ENABLE_PHYSICS_BOX2D_DETECT 1或#define ENABLE_PHYSICS_CHIPMUNK_DETECT 0改为#define ENABLE_PHYSICS_CHIPMUNK_DETECT 1,即打开BOX2D引擎或chipmunk引擎开关后,才有对getShapeList的声明

// 加载
ArmatureDataManager::getInstance()->addArmatureFileInfo(“DemoPlayer0.png”,“DemoPlayer0.plist”,“DemoPlayer.ExportJson”);

armature = Armature::create("DemoPlayer"); 
armature->setPosition(Point(visibleSize.width * 0.8,visibleSize.height * 0.5)); 
armature->getAnimation()->playByIndex(0); 
armature->setScale(0.25); 
this->addChild(armature);  


// 设置body 
auto playerPos = Point(armature->getPositionX(), armature->getPositionY());     
b2BodyDef bodyDef2; 
bodyDef2.type = b2_dynamicBody;            
bodyDef2.position.Set(playerPos.x/PT_RATIO, playerPos.y/PT_RATIO); 
bodyDef2.userData = armature;     

b2Body *playerBody = world->CreateBody(&bodyDef2);     
//playerBody->CreateFixture(&fixtureDef2); 
playerBody->SetGravityScale(10);  
armature->setBody(playerBody); 

// 设置filter 
b2Filter filter; 
filter.categoryBits = 1; 
filter.maskBits = 1;  
 

for (b2Fixture* shapes = armature->getBody()->GetFixtureList(); shapes; shapes = shapes->GetNext()) 
{ 
    //shapes->SetSensor(true); 
    shapes->SetDensity(5.0f/CC_CONTENT_SCALE_FACTOR()); 
    shapes->SetRestitution(1.0f); 
    shapes->SetFriction(0.2f);  
    shapes->SetFilterData(filter);      
}