Box2D Forums

It is currently Wed May 22, 2013 12:46 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Jun 30, 2012 2:24 pm 
Offline

Joined: Sat Jun 30, 2012 2:08 pm
Posts: 2
Hi, I've been playing around with Box2D on MSVC 2010 and I'm having a problem with the CreateFixture function, it won't accept a b2PolygonShape as it's first parameter.I went through some troubleshooting, checked the source code of the function, I know that it is defined as constant so that it doesn't alter the original object.Here's the code, same as is the HelloWorld example:

Code:
//BodyGround definition
b2BodyDef GroundBodyDef;
GroundBodyDef.position.Set(0.0f,-10.0f);

//Creating our body
b2Body *groundBody = world.CreateBody(&GroundBodyDef);

//Creating polygon   
b2PolygonShape groundBox;
groundBox.SetAsBox(50.0f,10.0f);

groundBody->CreateFixture(&groundBox,0.0f);



Thanks in advance.


Top
 Profile  
 
PostPosted: Sat Jun 30, 2012 2:54 pm 
Offline

Joined: Sun Oct 25, 2009 3:28 am
Posts: 242
Huh, that's odd. It shouldn't have any problem, since that's straight out from the Box2D manual. Are you sure you're not forgetting to include certain headers or if it's something else?

Try casting it as a b2Shape* when you pass it in. I'm sure that's not the issue, since that sort of thing works in the stuff I did, but just in case.


Top
 Profile  
 
PostPosted: Sat Jun 30, 2012 4:12 pm 
Offline

Joined: Sat Jun 30, 2012 2:08 pm
Posts: 2
jayther wrote:
Huh, that's odd. It shouldn't have any problem, since that's straight out from the Box2D manual. Are you sure you're not forgetting to include certain headers or if it's something else?

Try casting it as a b2Shape* when you pass it in. I'm sure that's not the issue, since that sort of thing works in the stuff I did, but just in case.


I tried casting but it was, indeed, a mistake with headers, I didn't pay attention and got trigger-happy to create this thread, thank you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group