free-language / box2d

Automatically exported from code.google.com/p/box2d
0 stars 0 forks source link

Static bodies are not allowed in some joints. #126

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a pulley (or revolute joint) with two dynamic bodies.
2. Set the bodies to be of type static
3. As assert failure will be thrown due to mass or fixed rotation issues 
(depending on joint type 
used).

For more info see this thread: 
http://www.box2d.org/forum/viewtopic.php?f=4&t=4891
Please Note: I am opening this bug per Erin Catto's request.

What is the expected output? What do you see instead?
Joint should allow connection between the bodies, but instead it fails via an 
Asset check.  

What version of the product are you using? On what operating system?
 (Box2d Version: Major: 2, Minor 1, Revision: 0)

Please provide any additional information below.
As noted in the thread, the manual should also be clarified.  

For more info and details on the issue see this thread: 
http://www.box2d.org/forum/viewtopic.php?f=4&t=4891
Please note: I am opening this bug per Erin Catto's request.

Original issue reported on code.google.com by Tralorni...@gmail.com on 29 Apr 2010 at 3:46

GoogleCodeExporter commented 9 years ago
I've not tested it fully, but I changed Farseer Physics Engine 3.0 to support 
mass on static bodies by changing Body::ResetMassData() to exit later on static 
bodes:

On the line:

// Kinematic and static bodies have zero mass.
if (....)

I took out the check for the static body type and moved it under the loop that 
accumulates the mass data on all fixtures.

I inserted this code under the loop (in C#)

if (_bodyType == BodyType.Static)
{
    _sweep.Center0 = _sweep.Center = _xf.Position;
    return;
}

Now static shapes have mass and they should work with joints.

Original comment by gentoo...@hotmail.com on 24 Jun 2010 at 1:13

GoogleCodeExporter commented 9 years ago

Original comment by erinca...@gmail.com on 25 Mar 2011 at 6:53