PhysicsBody and Sprite3D

Hello Community!
Can some one help me understand how i can create Sprite3D with physicsbody.
My 3d object loads well, if i create simple box i dont have any issue with simple phisics like Circle.
But if i load maked in Bleder model. Physics Body does not show and works.
I use Cocos2d-x v 3.8
Example of code:

myObj = Sprite3D::create("3ds/myObj.c3t");
myObj->setForce2DQueue(true);
myObj->setPosition( Point( visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y ) );

auto myBody = PhysicsBody::createCircle( 100, PHYSICSBODY_MATERIAL_DEFAULT );
myBody->setCollisionBitmask( MY_COLLISION_BITMASK );
myBody->setContactTestBitmask( true );
myBody->setDynamic(false);
myObj->setPhysicsBody( myBody );
layer->addChild( myObj, 1000 );

But this does not work.
I check using

scene->getPhysicsWorld( )->setDebugDrawMask( PhysicsWorld::DEBUGDRAW_ALL );

We can’t see the problem in this part of code, you are showing the code for one static object with a collision mask. The only thing I can say is that you are probably using an incorrect mask.
This is the second time I see setContactTestBitmask( true ); in this forum. A mask is an integer not a boolean.

Okey, i found what happen, my 3d sprite have more that one object in. So i think cocos2d-x does not know where hi must spawn my PhysicsBody. Elso i dont understand but, my 3d object have right center of coordinate, but cocos spawn PhisicsBody not on center of object.

Elso i have a question,
will 2d objects collide with 3d?
if i use setForce2DQueue(true);
or this does not metter? Because its is not work for me right now.

sorry for my bad english.

Can some one give me example, how create PhysicsBody from Mesh of Sprite3D ??

If you want 3D physics you should use bulletPhysics library, otherwise you can still use box2d for 2D game with 3D graphics.

1 Like

Okay, i’m understand, thank you!