QueryAABB not calling ReportFixture method
Posted: Sun Sep 08, 2013 7:26 pm
Hello,
So I am at a point were I want to to use my mouse to interact with the dynamic bodies in my scene. Pretty common thing to do. I looked the reference on how it was done in the sample loader for cocos2d using obj-c and the box2d testbed with the cocos2d-x example which I am using. Now everything is pretty much together. I am using logs to debug and I can confirm I am touching the the screen so I know my ccTouchBegan method works.
Thats another that is different. In the cocos2d-x testbed they use
bool Box2DView::ccTouchBegan(Touch* touch, Event* event)
and in the cocos2d, obj-c, iphone example it uses
(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
but it shouldnt really matter since I just want it to use one touch at a time. In cocos2d-x they make a method called MouseDown(const b2Vec2& p) that uses the box2d code and it is call in the ccTouchBegan method in your specified scene.
Its all good until I reach this statement:
m_world->QueryAABB(&callback, aabb);
for whatever reason, QuertAABB is not calling the ReportFixture method in the query callback. This is the problem.
Edit: I placed a CCLog call inside of ReportFixture method thats how I know it doesn't make it inside there.
It doesn't matter if I use the TouchDownQueryCallback class in the sample loader or the QueryCallback class in the box2d testbed example.
The only real difference I can think of at the moment is that all the example code in cocos2d-x and the sample loader is using Box2D 2.2.1 and I updated mine in my project to 2.3.0 and maybe that is why QueryAABB is not calling ReportFixture. Is there a difference between the two versions?
Thank you,
Paul.
So I am at a point were I want to to use my mouse to interact with the dynamic bodies in my scene. Pretty common thing to do. I looked the reference on how it was done in the sample loader for cocos2d using obj-c and the box2d testbed with the cocos2d-x example which I am using. Now everything is pretty much together. I am using logs to debug and I can confirm I am touching the the screen so I know my ccTouchBegan method works.
Thats another that is different. In the cocos2d-x testbed they use
bool Box2DView::ccTouchBegan(Touch* touch, Event* event)
and in the cocos2d, obj-c, iphone example it uses
(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
but it shouldnt really matter since I just want it to use one touch at a time. In cocos2d-x they make a method called MouseDown(const b2Vec2& p) that uses the box2d code and it is call in the ccTouchBegan method in your specified scene.
Its all good until I reach this statement:
m_world->QueryAABB(&callback, aabb);
for whatever reason, QuertAABB is not calling the ReportFixture method in the query callback. This is the problem.
Edit: I placed a CCLog call inside of ReportFixture method thats how I know it doesn't make it inside there.
It doesn't matter if I use the TouchDownQueryCallback class in the sample loader or the QueryCallback class in the box2d testbed example.
The only real difference I can think of at the moment is that all the example code in cocos2d-x and the sample loader is using Box2D 2.2.1 and I updated mine in my project to 2.3.0 and maybe that is why QueryAABB is not calling ReportFixture. Is there a difference between the two versions?
Thank you,
Paul.