I have a problem and I don’t find the solution anywhere after some searching on google. Here is the setup:
-Create 2 cube and make it rigidbody in physic tab
-Create a plane above the 2cube for the floor
-Press “P” to see if all going fine.
-Make cube1 child of cube2 with “compound” enable on both of them.
-On cube1,make a keyboard sensor and a parent actuator set to “remove parent” for when you press SpaceBar.
-Press “P” to run the game.
I don’t know if the samething happen for all of you but for me all working fine until I press the SpaceBar. The child is removed from is parent but lost all is rigidbody properties. It’s stay fixed with no collision for other rigidbody like a Static object in Ghost mode.
Somebody can tell me what I doing wrong or if not, a workaround is possible in logic brick or python?
One solution is to make a complete replacement child object with “rigid body” physics. When you unparent the child, switch the child object out completely using endObject and addObject. This gets rid of the child object that has the issues and replaces it with a completely new object that behaves exactly as you want it to. I know this is a bit of a brute force workaround and there may be alternatives, but it should work.
From my experience the physics related to child objects is a bit dodgy in several areas. Personally, I’d say that the root cause of this is the historical lack of people that use advanced areas of the game engine (such as specific uses of the physics engine). Since not many people have used this extensively there may be features that are missing or poorly implemented.
Having said this, recent improvements in the game engine physics are pretty inspiring. The recent patch (I think by moerdn?) for support of collision groups is one example of this.
You can remove a constraint during the game is playing in python?
I know how to create Bullet Contraints in python and remove it but the choice of 6DOF is not there in
this python module.6DOF only in the blender interface constraint panel when the game is stopped.
This page contains info for creating 6DoF constraints along with all the parameters that are available such as limits, springs and motors using the setParam() method of the constraint.
This page contains info and example scripts for removing constraints.
I don’t think the contents of these pages is available in the official documentation for some reason and when working on my ragdolls addon this was the only place on the net that I could find this information (it took quite a bit of digging and some creative search strings to find it ;)). I think the pages were originally written for Blender 2.49b so the script examples might require some modification, but the parameters and the enums (eg. 12 for 6DoF) all work just the same in Blender 2.59. One thing that will need to change in the scripts is changing the deprecated “PhysicsConstraints” module for “bge.constraints”. Another is to change “GameLogic” for “bge.logic”. With these two modifications the scripts should work in 2.59.
Looking at the api documentation, I think the 6DoF constraint might now be called pointtopoint or angular constraint? Regardless, if you use the number 12 for the constraint type, it will create a 6DoF constraint just like in those example pages.
I think the api documentation is auto-generated in some way so I’m not sure how to update it, but this part of the api definately needs documenting.
I already know the bge.constraint and I play a bit with it. With removecontraint() and getConstraintId() , you can remove the constraint when you want. How many other constraints type is hided like this ?
But did all this math in python make my simulation really slow when I have a lot of object. My goal is not to get a realtime simulation , but a precalculed/baked one with less time as possible.
I did some test and already existing bullet constraint is 20times faster then my spring python constraint. Okay okay … I need to make some work on it to optimize it too but … python is slower (interpreted language) and don’t use multitread processor, just one.
but again … thank a lot. I test it and I let’s you know if it what I’m searching for about a couples of days.:eyebrowlift:
FunkyWyrm: Nice , I try it and I think it’s exactly what a want. It’s increase constraint possibility more wider.
FunkyWyrm or somedyelse know if setLinearAirDamping or setSolverDamping work ? I set any value and I see nothing changed. Or a way to create damping with this constraints because the 6DOF spring bounce for ever or for a very long time?
Ahh… Yes, the essential setParam function is not documented at all on blender.org as it looks. That kind of explain why rigid body constraints are used so little. To me they beat animation in all ways for stuff like opening doors etc.
I miss damping to… It’s not sure we want a rigid body object to have the same damping when it’s not constrained and we can’t change the damping on the object run-time what I know. Replacing the object with end/add object is a bit tedious.
It can be solved by using the motor to crate damping but usually the motor parameter have to be changed every frame so the python code have to run every frame. That a bit expensive but work as long it not to many objects with damping.
I’ve not played with it yet, but the spring looks like it could be made to act as damping.
The spring parameter has a “stiffness” value and a “reset” value. “Reset” defines whether the spring returns to it’s original position. If this is set to False then the spring will not return to the original position, but should still have the “stiffness”. “Stiffness” without “reset” might act like damping? It’s the last parameter listed on the page I linked before, just above the last code example. Link
LaH : yes … damping on the object itself is not really good and i’m a bit sad if you cannot change it during game. The best thing is to have access to a constraint damping.
FunkyWyrm : Damping and stiffness is not the same thing , with or without the reset options. Damping is a resistance , a “friction” on the constraints. In the case of a spring , is make the spring lost in force over time to prevent too much bouncing and you can have access to how much “friction” you want. In my spring constraint python script , I make a damp parameter and it’s working fine. The stiffness without reset option look like more of a clay you push and stiffness act like how firm is you clay. Your rigidbody never return to it’s original position and go farter each time you push it. Yes it’s act like a damper … but without spring. What I need in this case is a slider controlling the weight between “Reset to position” and " Not reset to Position ". Not just a On and Off.
I don’t know if you see my video but to explain the “reset” option : If I did the same setup with the bullet 6dof spring constraint with the reset option at ON , my cube probably giggle like jello for a long time. If I put it at Off , it’s just bump and ply keeping it’s deformation like clay. Damping it’s a weight between this two state.
I read somehere integration of bullet in blender is not multithread but work only on one processor
I know rendering is multithread , but what others parts of blender is not ?
Today , with all multi-core/multi-processor computer has a standard on the market (Even my parents have a multiprocessors/cores computer ) , it’s a big issue for a software to don’t have all is features multithreaded I think. Blender need this to “multi-kick” the *** of autodesk ! :yes:
As far as I know it’s only the rendering that’s multithreaded in Blender.
Blender’s Python isn’t thread safe and allowing scripts to run on a separate thread would be great. Also, bge is about 10 years old although recent updates have done much to improve it. Multithreading support for the game engine would really give it a boost even if only the physics was on a separate thread. With increased demand for realism in games physics engines have possibly recieved the biggest improvements after rendering, but much of the rendering is offloaded to graphics cards so the biggest boost to the game engine could be enabling multiprocessor support for physics. (I understand that there are differences between multithreading and multiprocessing, but both would be nice. ;))