Box2D Version 2.0.1 Released

snake5:
I think you are trying to do:

Code: Select all

myShape->GetFilterData().groupIndex=newValue;
myWorld->Refilter(myShape);
rather than

Code: Select all

dmFilterData filter = myShape->GetFilterData();
filter.groupIndex = newValue;
myShape->SetFilterData(filter):
myWorld->Refilter(myShape);
Though the first way looks much shorter, and it would work if the 'const' keyword were removed, there is a reason that the second way is preferred, and indeed, enforced.

The problem is, for the former code to work, it oblidges myShape->GetFilterData to return the actual filter data object that it is using, rather than a copy. Otherwise, you wouldn't be changing anything permanent with the assignation. But once you are returning the actual private variable of shape, m_filter, there is little point wrapping it in a Get/Set function, you might as well just expose it as public. The whole point of using functions for a public interface is that it hides the internal implementation from view. With the latter code, you can change as much behind the scenes as you like, say removing the filter data object entirely, and it

A similar issues applies to vectors. You should get the same error messages if you tried body->GetPosition().x=100; and for good reason.
oh, I see now..
thanks for explaining
nice work...I like the makefile, but don't now what the *.d files are...
also what can I do to compile testbed using openglut? in v2.0 I had to change some #include lines, is there easier method?
The .d files are dependency files used by (included by) the Makefile itself. The files are generated automatically if you make all. They are useful if you change any of the include files in the source code because make will then rebuild all of the dependent source files.

Instead of editing the references to freeglut in each source file you could replace the freeglut directory with a symbolic link to the openglut include files. You would also have to remove the reference to freeglut in the LDFLAGS variable in the Makefile. I don't know if all that is really simpler though.
can anyone tell me the fdiference between the libs in Source/fixed and Source/float ???

also ... awesome work with the makefile... what a pleasent surprise 😀
The files in Gen/float are the floating point compilation of the library. This is the standard version (i.e. the one the Erin designs and supports). Unless you are using a processor without a floating point unit, use this version.

The library in Gen/fixed is compiled for fixed point arithmetic. The fixed point version was contributed by myself and 0xtob, developed mainly for the Nintendo DS but applicable to other platforms. The fixed point version is not as well supported. You will notice, for example, that the latest added example in the testbed crashes in the fixed point version (I have a fix for that, but it needs some more work).
hmmm ...

can anyone shed some light in the new Result() in the b2ContactListener ??

also ... I'm implementing a Contact Listener but, ever since changing to 2.0.1 its no longer working ... any thing needed to do besides the change of

world->SetListener(l) to world->SetContactListener(l) ???
Make sure your contact listener methods take const b2ContactPoint* or you won't be overriding the default listener methods. I got burned by that when I updated to 2.0.1 as well. 🙂
Hmm, maybe I should make all the callback functions pure virtual.
kdmiller3 wrote:Make sure your contact listener methods take const b2ContactPoint* or you won't be overriding the default listener methods. I got burned by that when I updated to 2.0.1 as well. 🙂



right you are sir ... very tricky.

In another matter ... sense my switch to 2.0.1 some of my sensors started to malfunction. after some prints I realise that there is two points of collision being added by the same two shapes ...
shouldn't two shapes (in this case a rectangle as a circle) keep the same point and not create another?

Original thread: https://box2d.org/forum/viewtopic.php?t=711