Sprites were successfully dropped on the simulator. However, it crashed when tested on the device.
I tried gravity and no gravity. And when it did not receive gravity it did not crash. Therefore, I found that it crashes when the sprite moves. But I do not know the solution from there, please tell me
void HelloWorld::addNewSpriteAtPosition(Vec2 p)
{auto spr = Sprite::create(âaaa.pngâ);
spr->setPosition( p );Point spritePoints[8] = { Point(-43, 0), Point(-31, 18), Point(-1, 26), Point(27, 19), Point(43, 0), Point(29, -19), Point(1, -26), Point(-28, -17) }; auto sprBody = PhysicsBody::createPolygon(spritePoints, 8, PhysicsMaterial(0.0f, 1.0f, 0.5f)); sprBody->setDynamic(true); spr->setPhysicsBody(sprBody); this->addChild(spr, 1);
}
Thanks.