Page MenuHome

Rigid body joints from older files don't appear to work,
Closed, ResolvedPublic

Description

System Information
win 7 . nvidia 210

Blender Version
Broken 2.73
worked 2.72

game made in 2.72 - Character core falls though ground.

press play in 2.72 = Character (ball) lands on ground

press play in 2.73 = Character (ball) lands on gound, object 'PushIT' falls though ground

file - http://theorysend.com/view/a0b4331466d7dd42607c65281aadf7e76de9532d

Another project made in 2.67 had the same issue,

Event Timeline

Could you please upload a simpler file that demonstrates the problem? The simpler the blend file, the quicker and easier it is to find and fix the problem.

The rigid body joint on the ball fails,

The object PushIt, is what it is targeting,

I am not sure why, but all my old games, the rigid body joints fail on startup, It happened to a paid dev gig I got, but the file is non under contract..... That file is from 2.69

Open a few old projects with rigid body joints?

The files work in 2.72, so what changed in that area of the code? Hg1 added something about physics crashes?

It looks like that an end object on another object will delete all rigid body joints.
Maybe it depends on my T41294 fix. But I have made some deletion tests with earlier Blender versions and everything was working properly.
So I don't know if only my patch, or some other changes or a combination between my and an other patch will cause this bug.

Example file.

You found it!

Thank you, I was having some trouble reproducing it,

A question:

in source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp at CcdPhysicsEnvironment::RemoveCcdPhysicsController function:

why do we need to call this function --> line 511: body->removeConstraintRef(con);

I checked the function called by --> line 510: m_dynamicsWorld->removeConstraint(con); and this function already contains a call to removeConstrainRef.

Perhaps it would be redundant?

I did a git bisect yesterday and the commit that cause the bug (as HG1 supposed) is https://developer.blender.org/rB47ebf96de47de4ae66cdc0ddf8f72a95ef8dd49d

I reviewed the commit and i saw the following:

We are doing a loop over all the constrains of the m_dynamicsWorld instead of doing the loop over the constrains in the rigid body only. This way when we call to RemoveCcdPhysicsController we will remove all the constrains in the scene.

for (int i = m_dynamicsWorld->getNumConstraints()-1;i>=0;i--)  
       {
           btTypedConstraint *con = m_dynamicsWorld->getConstraint(i);
           m_dynamicsWorld->removeConstraint(con);
           body->removeConstraintRef(con);
           //delete con; //might be kept by python KX_ConstraintWrapper
       }

I checked quickly also the solution proposed by erwin to remove the constrains of the rigid body (http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=2814) but it crashed with an assert.

while (body->getNumConstraintRefs())
   {
      btTypedConstraint* con = body->getConstraintRef(0);
      m_dynamicsWorld->removeConstraint(con);
   }

I think I have finally fixed the bug. Blender don't sore the constraint reference on the rigid body. So the actual reference is always zero.
We need to revert my changes and add rb0->addConstraintRef(constraintType) to every created joint.
I have made some shot tests and so far it looks good. But I want to make some additional tests at the weekend. Then I will provide the new patch.

@Jorge Bernal (lordloki)
m_dynamicsWorld->removeConstraint(con) removes the constraint references the additional references if the collision between linked bodies is deactivated.
body->removeConstraintRef(con) removes the constraint reference on the rigid body.

Hugo Barreira (hbar) lowered the priority of this task from 90 to 50.Jan 17 2015, 4:15 AM

I confirm that the deletion of an object using the actuator
"edit object -> end object" or
"edit object -> add object -> some time set"
also delete any constraint in the scene
worked on blender version (2.72)
not working on blender version (2.73)
I'm glad someone already detected this as I was about to report the same bug.
maybe a change in the title would help to find this bug and avoid others to report the same bug.

I have added a fix to the differential D1007.

Did this make it into 2.73a?

or when is it slated?

2.74?

No the patch is not in Blender 2.73a. There will be a message in D1007 if the patch will be applied.

I don't know when it will be committed.

Thank you all!

Is this in 2.73a or a test build?

I have some older files that had random crashing when using rigid body joints,

The patch is not in Blender 2.73a.
The test build that I linked in this post is somewhere between 2.73a and 2.74.
The patch will be in the Blender 2.74 release.

You can test it with an actual build from the build bot https://builder.blender.org/download/.