Not able to instantiate an AABB object

General Box2D issues or C++ specific issues
upman
Posts: 1
Joined: Wed Apr 08, 2015 12:05 am

Not able to instantiate an AABB object

Postby upman » Wed Apr 08, 2015 12:12 am

Hey!
I'm new to using Box2D and C++ in general.

I'm trying to detect the body which was click on.
I've read that I need to do a world AABB query. But I'm not able to create an b2AABB object properly for this.

b2AABB aabb;
aabb.lowerBound = b2Vec2(1,0);

Gives me the error
error: ‘aabb’ does not name a type
aabb.lowerBound = b2Vec2(1,0);


Any help would be appreciated.
Thanks.

nigelk
Posts: 4
Joined: Sun Apr 26, 2015 1:25 am

Re: Not able to instantiate an AABB object

Postby nigelk » Mon Apr 27, 2015 4:47 am

Hi, did you put these lines in a block like main() ? or in the global space ? because this error happends when you put some function call in the global space.
I mean maybe you've done something like this :

Code: Select all

#include ....

b2AABB aabb;
aabb.lowerBound = b2Vec2(1,0);

int main()
{...}

when it should be something like this :

Code: Select all

#include ....

b2AABB aabb;

int main()
{
     aabb.lowerBound = b2Vec2(1,0);
}


Nigel


Return to “Bugs, Requests, and Feedback”



Who is online

Users browsing this forum: No registered users and 1 guest