Restitution broken in 2.45

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
Icoxo
Posts: 24
Joined: Fri Feb 10, 2006 4:39 pm

Restitution broken in 2.45

Post by Icoxo »

http://blenderartists.org/forum/showthr ... post968809
Restitution simply doesn't work in 2.45. Works in 2.44.

Erwin, this is an large bug in your area of the GE's development, essemcially makes things like good mini-golf games impossible without a bounce python script.

Thanks in advance for looking into it.
calli
Posts: 34
Joined: Tue Jul 12, 2005 1:15 pm

Re: Restitution broken in 2.45

Post by calli »

I found exactly the same together with my students. Maybe it is a Blender Bug then I will fill in a bugreport for the GE, but I think it is more related to Bullet?

See attached .blend (.zip because .blend is not allowed here... :roll: )

Best Regards,
Carsten
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Restitution broken in 2.45

Post by Erwin Coumans »

It was a bug in the Bullet version used for Blender 2.45. A new constraint solver was used. It can be easily fixed with a one-liner, if you re-compile Blender from code:

Add the setSolverMode around line 560 of in blender\source\gameengine\Physics\Bullet\CcdPhysicsEnvironment.cpp

Code: Select all

void		CcdPhysicsEnvironment::setSolverType(int solverType)
{

	switch (solverType)
	{
	case 1:
		{
			if (m_solverType != solverType)
			{

				m_solver = new btSequentialImpulseConstraintSolver();
				m_solver->setSolverMode(btSequentialImpulseConstraintSolver::SOLVER_USE_WARMSTARTING | btSequentialImpulseConstraintSolver::SOLVER_RANDMIZE_ORDER);

				break;
			}
		}
It will be fixed when I get to update to a new version of Bullet 2.64.

Can you let us know if that works?
Erwin
calli
Posts: 34
Joined: Tue Jul 12, 2005 1:15 pm

Re: Restitution broken in 2.45

Post by calli »

Code: Select all

Compiling ==> 'SumoPHYCallbackBridge.cpp'
source/gameengine/Physics/Sumo/Fuzzics/include/SM_Callback.h:4: warning: ‘class SM_Callback’ has virtual functions but non-virtual destructor
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h: In constructor ‘CcdPhysicsEnvironment::CcdPhysicsEnvironment(btDispatcher*, btOverlappingPairCache*)’:
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h:236: warning: ‘CcdPhysicsEnvironment::m_scalingPropagated’ will be initialized after
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h:59: warning:   ‘int CcdPhysicsEnvironment::m_numIterations’
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp:298: warning:   when initialized here
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp: In member function ‘void CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController*)’:
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp:360: warning: unused variable ‘scene’
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp: In member function ‘virtual bool CcdPhysicsEnvironment::proceedDeltaTime(double, float)’:
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp:474: warning: comparison between signed and unsigned integer expressions
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp: In member function ‘virtual void CcdPhysicsEnvironment::setSolverType(int)’:
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp:559: error: ‘class btConstraintSolver’ has no member named ‘setSolverMode’
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp: In member function ‘virtual PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IPhysicsController*, float, float, float, float, float, float, float&, float&, float&, float&, float&, float&)’:
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp:693: warning: unused variable ‘minFraction’
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp: In member function ‘virtual void CcdPhysicsEnvironment::CallbackTriggers()’:
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp:904: warning: unused variable ‘ctrl0’
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp:904: warning: unused variable ‘ctrl1’
source/gameengine/Physics/Sumo/Fuzzics/include/SM_MotionState.h:37: warning: ‘class SM_MotionState’ has virtual functions but non-virtual destructor
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp: At global scope:
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp:262: warning: ‘void DrawAabb(btIDebugDraw*, const btVector3&, const btVector3&, const btVector3&)’ defined but not used
scons: *** [/home/src/bdev/build/linux2/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.o] Error 1
scons: building terminated because of errors.
cw@Manta:/home/src/bdev/blender$                                    
Hmm. error: ‘class btConstraintSolver’ has no member named ‘setSolverMode’ is the error I guess? Missing include or mix of Bullet Versions?

Greetings,
Carsten
mal
Posts: 16
Joined: Mon Jul 11, 2005 8:39 am
Location: Ireland

Re: Restitution broken in 2.45

Post by mal »

Hi Erwin,

I also tried adding in the one line patch with the latest svn version of Blender, and am finding the same issue...

'setSolverMode' : is not a member of 'btConstraintSolver'


I tried downloading the bullet-2.68.zip file, to see if setSolverMode has been defined in the latest SDK, but there seems to be an issue at the moment with downloading ( I'll try again later today ). If it's defined in the latest SDK, hopefully it'll be possible to update to the latest Bullet version within the Blender svn.


As restitution is currently broken in the current Blender build, it would be great to get it fixed for the 2.45 release - the GE has had some great updates recently in many other areas!

Mal
mal
Posts: 16
Joined: Mon Jul 11, 2005 8:39 am
Location: Ireland

Re: Restitution broken in 2.45

Post by mal »

Problem solved :)

I tried casting with...
((btSequentialImpulseConstraintSolver*)m_solver->setSolverMode

This compiled OK, but crashed when running.

Ben fixed the issue, and sent me his solution...
((btSequentialImpulseConstraintSolver*)m_solver)->setSolverMode

Which, of course, works perfectly - Doh! :)

Many thanks to Ben for applying the patch to SVN.
Mal
calli
Posts: 34
Joined: Tue Jul 12, 2005 1:15 pm

Re: Restitution broken in 2.45

Post by calli »

Jippieee!

Thanks,
Carsten