Hello I’m working in a simple game where I need to use cocos 2d-x with 3D physics, but I have no idea of how to use this.
I saw the example in the Cpp-Tests but they’re no very clearly of how you need to set up this feature, also it’s not easy to understand how is the scene created.
Ok this is what I have.
bool Meteor3D::init()
{
if(!Sprite3D::create())
{
return false;
}
_model = Sprite3D::create(_filePath,_fileTexture);
this->addChild(_model);
_model->setScale(15.f);
//Run some schedule but where are the collisions ?
//create a collider using colliderDes
Physics3DColliderDes colliderDes;
colliderDes.shape = Physics3DShape::createSphere(10.0f);
colliderDes.isTrigger = true;
auto collider = Physics3DCollider::create(&colliderDes);
auto component = Physics3DComponent::create(collider);
auto node = Node::create();
addChild(node);
node->addComponent(component);
collider->onTriggerEnter = [=](Physics3DObject *otherObject){
//some body entering
//But never works
};
collider->onTriggerExit = [=](Physics3DObject *otherObject){
//some one leaving
//But never works
};
this->scheduleUpdate();
return true;
}
If I have two objects in the same scene and layer they should collide right ?
I will keep looking for this of course I when I have something working I will share an example.
BTW I’m using c3b files not obj file extension.
t.i.a.