This commit is an attempt to improve collisions between moving Bullet rigid bodies using (concave) triangle mesh bounds.
Instead of using Gimpact, this we create a btCompoundShape with child shape tetrahedra derived from the surface triangles.
For each triangle, we add a fourth vertex using the centroid, shifting inwards using the triangle normal.
If the centroid hits an internal triangle, we stop. The default depth could be exposed as 'advanced' setting in the user interface.
This solution will be a slower than the original/gimpact solution, but a bit more reliable.
In the future, it is better to add HACD, convex decomposition to Blender, for moving concave meshes.
See http://kmamou.blogspot.com and the Bullet SDK's Demos/ConvexDecompositionDemo.
* jump() -- causes the character to jump
* onGround -- specifies whether or not the character is on the ground
* gravity -- controls the "gravity" that the character physics uses for the character
More options could be added (such as jump speed, step height, make fall speed, max slope, etc).
reported as [#29376] BMESH_TODO: remove tessface CD_ORIGINDEX layer
for a single mesh there could be 3 origindex mappings stored, one on the polygons and 2 on the tessfaces.
(CD_POLYINDEX and CD_ORIGINDEX).
as Andrew suggests, now tessfaces (which are really a cache of polygons), using origindex to point to polygons on
the same derived mesh, and polygons only store the original index values.
viewport. This helps to eliminate OpenGL calls in weird places like the physics
code and to reduce glGet calls, which are expensive.
There should be no functional changes (except maybe a very slight speed improvement).
The functions had no effect because m_solverInfo wasn't used anywhere.
Now we get the solver info from the dynamics world directly instead of using our own copy.
Note: This fix could cause other issues with shared physics meshes. In general, we may want to re-evaluate how we handle updating potentially shared physics meshes.
The problem was that the physics shapes for the near and radar sensor were getting turned into characters because CcdConstructionInfo::m_bCharacter was defaulting to true. Now it defaults to false and is explicitly set to true for only Character physics types.
========================
The linear and angular thresholds set the speed limit (in m/s) and rotation limit (in rad/s)
under which a rigid body will go to sleep (stop moving) if it stays below the limits for a
time equal or longer than the deactivation time (sleeping is disabled is deactivation time is
set to 0).
These settings help reducing the processing spent on Physics during the game.
Previously they were only accessible from python but not working because of a bug.
Now the python functions are working and the settings are available in the Physics panel
of the World settings when using the Blender Game render engine.
Python API:
import PhysicsConstraints
PhysicsConstraints.setDeactivationLinearTreshold(float)
PhysicsConstraints.setDeactivationAngularTreshold(float)
===============================================
This patch adds a new "Character" BGE physics type which uses Bullet's btKinematicCharacter for simulation instead of full-blown dynamics. It is appropiate for (player-controlled) characters, for which the other physics types often result unexpected results (bouncing off walls, sliding etc.) and for which simple kinematics offers much more precision.
"Character" can be chosen like any other physics type in the "Physics" section of the properties window. Current settings for tweaking are "Step Height" (to make the object automatically climb small steps if it collides with them), "Fall Speed" (the maximum speed that the object can have when falling) and "Jump Speed", which is currently not used.
See http://projects.blender.org/tracker/?func=detail&atid=127&aid=28476&group_id=9
for sample blends and a discussion on the patch: how to use it and what influences the behavior of the character object.
Known problem: there is a crash if the "compound" option is set in the physics panel of the Character object.