Rigid body joints from older files don't appear to work, #43215

Closed
opened 2015-01-12 06:40:43 +01:00 by Jacob Merrill · 23 comments

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,

**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,
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1
Author
video http://www.youtube.com/watch?v=BNoMkftHnAs&feature=youtu.be

Added subscriber: @Moguri

Added subscriber: @Moguri

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.

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.
Author

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?

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?
Member

Added subscriber: @hg1

Added subscriber: @hg1
Member

It looks like that an end object on another object will delete all rigid body joints.
Maybe it depends on my #41294 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.
Rigid_Body_Joint.blend

It looks like that an end object on another object will delete all rigid body joints. Maybe it depends on my #41294 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. [Rigid_Body_Joint.blend](https://archive.blender.org/developer/F136822/Rigid_Body_Joint.blend)
Author

You found it!

Thank you, I was having some trouble reproducing it,

You found it! Thank you, I was having some trouble reproducing it,
Member

Added subscriber: @JorgeBernalMartinez

Added subscriber: @JorgeBernalMartinez
Member

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?

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?
Member

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 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); } ```
Member

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.

@JorgeBernalMartinez
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.

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. @JorgeBernalMartinez 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.

Added subscriber: @HugoBarreira

Added subscriber: @HugoBarreira

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 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.
Member

I have added a fix to the differential D1007.

I have added a fix to the differential [D1007](https://archive.blender.org/developer/D1007).
Author

Did this make it into 2.73a?

or when is it slated?

2.74?

Did this make it into 2.73a? or when is it slated? 2.74?
Member

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.

No the patch is not in Blender 2.73a. There will be a message in [D1007](https://archive.blender.org/developer/D1007) if the patch will be applied. I don't know when it will be committed.

This issue was referenced by 87572091fb

This issue was referenced by 87572091fb73add461090f64f3b4bbaa42e3a093
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

Closed by commit 87572091fb.

Closed by commit 87572091fb.
Author

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,

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,
Member

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/.

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/.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#43215
No description provided.