Device clash by cocos2dx PhysicsWorld

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 :dizzy_face:

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.

The problem was solved.
I handed over from “bool HelloWorld::onTouchBegan” to “void HelloWorld::sprGo” using a “schedule_selector”. I worked after installing a rigid body in "void HelloWorld::sprGo":smiley: I just want to know why the crash occurred in the first way​:persevere:

Have you looked at our Programmers Guide, by chance?