Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17116

Why PhysicsBody::addShape() doesn't work while PhysicsBody::createBox() works

$
0
0

@xjfscrat wrote:

I have spent hours to figure out why my physics world doesn't work. Finally I found the root piece of code.

Below piece of code doesn't work :
auto ground_body = PhysicsBody::create();
ground_body ->setContactTestBitmask(0xffffffff);
ground_body ->addShape(PhysicsShapeBox::create(Size(width, height)));

Below piece of code works :
auto ground_body = PhysicsBody::createBox(Size(width, height));
ground_body ->setContactTestBitmask(0xffffffff);

Any one has clue why? Thanks !

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>