在cocostudio中的资源管理器描绘的边框如何在代码中使用啊??
我在Armature::create(“xxxx”)之后获取对象,并没有找到getShapelist之类的方法。是否能说下如何使用啊??非常感谢啊!!!
你好,这个 方法是在需要开启BOX2D引擎的,该方法用于返回形状列表。详见Testcpp中的示例。
好的,知道了,谢谢啊,不过3.0不是统一使用physics了吗?有计划以后在代码创建Armature的对象时直接内部完成吗?
testcpp中没找到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);
}