- ignore MSVC warnings when FREE_WINDOWS is defined to quiet warnings.
- the CMake flags were not being set correctly making blender have weirdo colors (no -funsigned-char).
A btBvhTriangleMeshShape object is created when converting
a mesh to physics, also in case of Soft body although the
soft body will not use it (it only uses the mesh interface).
This patch keeps this system for compatibility with the
KX converter but avoids the creation of the BVH structure,
which consumes a lots of CPU. This should speed up
significantly the conversion of large mesh to softbody.
A secondary optimization is that the sharing of shapeInfo
is extended to rigid body using gImpact. Before it was
only active between static body and soft body.
Even a static mesh can be used as replacement: the mesh
will be instantiated with the soft body settings of the
object. The position and orientation of the soft body
is preserved after the replacement.
Known limitation: the velocity of the soft body is reset
aftet the replacement. This is because soft body don't
have a well defined velocity.
Add support back for reinstancePhysics mesh, a frequently requested feature in the BGE forums.
from what I can tell Sumo supported this but bullet never did.
Currently only accessible via python at the moment.
- rigid body, dynamic, static types work.
- instanced physics meshes are modified too.
- compound shapes are not supported.
Physics mesh can be re-instanced from...
* shape keys & armature deformations
* subsurf (any other modifiers too)
* RAS_TexVert's (can be modified from python)
Moved the reinstancePhysicsMesh functions from RAS_MeshObject into KX_GameObject since the physics data is stored here.
video and blend file demo.
http://www.graphicall.org/ftp/ideasman42/reinstance.ogvhttp://www.graphicall.org/ftp/ideasman42/reinstance_demo.blend
* removed radiosity render code, DNA and RNA (left in radio render pass options), we'll get GI to replace this probably, better allow baking to vertex colors for people who used this.
* removed deprecated solid physics library, sumo integrations and qhull, a dependency
* removed ODE, was no longer being build or supported
* remove BEOS and AMIGA defines and references in Makefiles.
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD
Notes:
* Game and sequencer RNA, and sequencer header are now out of date
a bit after changes in trunk.
* I didn't know how to port these bugfixes, most likely they are
not needed anymore.
* Fix "duplicate strip" always increase the user count for ipo.
* IPO pinning on sequencer strips was lost during Undo.
http://blenderartists.org/forum/showpost.php?p=1382653&postcount=102
(todo: expose this setting in World setting GUI)
Expose contact processing threshold in Advanced GUI, next to rigid body margin, called CPT.
Default to 1, makes rigid body stacking a bit more stable, smaller values makes sliding easier (at the cost of easier jittering).
Disabled for 'dynamic' objects that don't rotate, because characters etc. always need smooth sliding.
SCA_RandomActuator: The random generator was shared between replicas and not deleted. Added ref counting between replicas to allow deletion at the end.
KX_Camera: The scenegraph node was not deleted for temporary cameras (ImageMirror and shadow), causing 500 bytes leak per frame and per shadow light.
KX_GameActuator: Global dictionary buffer was not deleted after saving.
KX_MotionState: The motion state for compound child was not deleted
KX_ReplaceMeshActuator: The mesh was unnecessarily converted for each actuator and not deleted, causing large memleak.
After these fix, YoFrankie runs without memleak.
Compound shape control
======================
1) GUI control
It is now possible to control which child shape is added to
a parent compound shape in the Physics buttons. The "Compound"
shape button becomes "Add to parent" on child objects and
determines whether the child shape is to be added to the top
parent compound shape when the game is stated.
Notes: * "Compound" is only available to top parent objects
(objects without parent).
* Nesting of compound shape is not possible: a child
object with "Add to parent" button set will be added
to the top parent compound shape, regardless of its
position in the parent-child hierarchy and even if its
immediate parent doesn't have the "Add to parent" button set.
2) runtime control
It is now possible to control the compound shape at runtime:
The SetParent actuator has a new "Compound" button that indicates
whether the object shape should be added to the compound shape
of the parent object, provided the parent has a compound shape
of course. If not, the object retain it's individual state
while parented.
Similarly, the KX_GameObject.setParent() python function has
a new compound parameter.
Notes: * When an object is dynamically added to a compound
shape, it looses temporarily all its physics capability
to the benefit of the parent: it cannot register collisions
and the characteristics of its shape are lost (ghost, sensor,
dynamic, etc.).
* Nested compound shape is not supported: if the object
being parented is already a compound shape, it is not
added to the compound parent (as if the Compound option
was not set in the actuator or the setParent function).
* To ensure compatibility with old blend files, the Blender
subversion is changed to 2.48.5 and the old blend files
are automatically converted to match the old behavior:
all children of a Compound object will have the "Add to
parent" button set automatically.
Child ghost control
===================
It is now possible to control if an object should becomes ghost
or solid when parented. This is only applicable if the object
is not added to the parent compound shape (see above).
A new "Ghost" button is available on the SetParent actuator to
that effect. Similarly the KX_GameObject.setParent() python function
has a new compound parameter.
Notes: * This option is not applicable to sensor objects: they stay
ghost all the time.
* Make sure the child object does not enter in collision with
the parent shape when the Ghost option if off and the parent is
dynamic: the collision creates a reaction force but the parent
cannot escape the child, so the force builds up and produces
eratic movements.
* The collision capability of an ordinary object (dynamic or static)
is limited when it is parented: it becomes automatically static
and can only detect dynamic and sensor objects.
* A sensor object retain its full collision capability when parented:
it can detect static and dynamic object.
Python control
==============
KX_GameObject.setParent(parent,compound,ghost):
Sets this object's parent.
Control the shape status with the optional compound and ghost parameters:
compound=1: the object shape should be added to the parent compound shape (default)
compound=0: the object should keep its individual shape.
In that case you can control if it should be ghost or not:
ghost=1 if the object should be made ghost while parented (default)
ghost=0 if the object should be solid while parented
Note: if the object type is sensor, it stays ghost regardless of ghost parameter
parent: KX_GameObject reference or string (object name w/o OB prefix)
Added an 'Invisible' button to make this more clear, it seems like a display option but its also related to logic because the actuators can toggle this after the game starts.
Without this its annoying to add UV's only to set the invisible flag.
Sensor objects were not clearing the softbody gameflag
A new type of "Sensor" physics object is available in the GE for advanced
collision management. It's called Sensor for its similarities with the
physics objects that underlie the Near and Radar sensors.
Like the Near and Radar object it is:
- static and ghost
- invisible by default
- always active to ensure correct collision detection
- capable of detecting both static and dynamic objects
- ignoring collision with their parent
- capable of broadphase filtering based on:
* Actor option: the collisioning object must have the Actor flag set to be detected
* property/material: as specified in the collision sensors attached to it
Broadphase filtering is important for performance reason: the collision points
will be computed only for the objects that pass the broahphase filter.
- automatically removed from the simulation when no collision sensor is active on it
Unlike the Near and Radar object it can:
- take any shape, including triangle mesh
- be made visible for debugging (just use the Visible actuator)
- have multiple collision sensors using it
Other than that, the sensor objects are ordinary objects. You can move them
freely or parent them. When parented to a dynamic object, they can provide
advanced collision control to this object.
The type of collision capability depends on the shape:
- box, sphere, cylinder, cone, convex hull provide volume detection.
- triangle mesh provides surface detection but you can give some volume
to the suface by increasing the margin in the Advanced Settings panel.
The margin applies on both sides of the surface.
Performance tip:
- Sensor objects perform better than Near and Radar: they do less synchronizations
because of the Scenegraph optimizations and they can have multiple collision sensors
on them (with different property filtering for example).
- Always prefer simple shape (box, sphere) to complex shape whenever possible.
- Always use broadphase filtering (avoid collision sensor with empty propery/material)
- Use collision sensor only when you need them. When no collision sensor is active
on the sensor object, it is removed from the simulation and consume no CPU.
Known limitations:
- When running Blender in debug mode, you will see one warning line of the console:
"warning btCollisionDispatcher::needsCollision: static-static collision!"
In release mode this message is not printed.
- Collision margin has no effect on sphere, cone and cylinder shape.
Other performance improvements:
- Remove unnecessary interpolation for Near and Radar objects and by extension
sensor objects.
- Use direct matrix copy instead of quaternion to synchronize orientation.
Other bug fix:
- Fix Near/Radar position error on newly activated objects. This was causing
several detection problems in YoFrankie
- Fix margin not passed correctly to gImpact shape.
- Disable force/velocity actions on static objects
This commit completes the support for modifiers in the BGE.
- The physic shape is generated according to the derived mesh.
This is true for all types of shapes and all types of
objects except soft body.
- Optimization for static derived mesh (mesh with modifiers
but no armature and no shape keys). Replicas will share
the derived mesh and the display list: less memory and
faster rendering. With this optimization, the static
derived mesh will render as fast as if the modifiers were
applied.
Known Limits:
- Sharing of mesh and display list is only possible between
in-game replicas or dupligroup. If you want to instantiate
multiple objects with modifiers, use dupligroup to ensure
best memory and GPU utilization.
- rayCast() will interact with the derived mesh as follow:
Hit position and hit normal are the real values according
to the derived mesh but the KX_PolyProxy object refers to
the original mesh. You should use it only to retrieve the
material.
- Dynamic derived mesh have very poor performance:
They use direct openGL calls for rendering (no support
for display list and vertex array) and they dont't share
the derived mesh memory. Always apply modifiers on dynamic
mesh for best performance.
- Time dependent modifiers are not supported.
- Modifiers are not supported for Bullet soft body.
Clamp objects min/max velocity.
Accessed with bullet physics from the advanced button with dynamic and rigid body objects.
- useful for preventing unstable physics in cases where objects move too fast.
- can add linear velocity with the motion actuator to give smooth motion transitions, without moving too fast.
- minimum velocity means objects don't stop moving.
- python scripts can adjust these values speedup or throttle velocity in the existing direction.
Also made copy properties from an object with no properties work (in case you want to clear all props)
Was adding each face with a remove doubles option that made conversion increasingly slower for larger meshes, this would often hang blender when starting with the BGE with larger meshes.
Replace btTriangleMesh()->addTriangle() with btTriangleIndexVertexArray()
YoFrankie level_1_home.blend starts a third faster, level_nut about twice as fast.
- previous commit was also incorrect using the original meshes vert locations rather then the vert locations that came from the derived mesh.
- Softbody is relying on removing doubles at 0.01 to give stable results, this no longer works but seems a bit dodgy anyway. Maybe some post-processing filter could fix up a mesh for bullet softbody.
This patch modifies the way the setParent actuator and KX_GameObject::setParent() function
works when parenting to a compound object: the collision shape of the object being parented
is dynamically added to the coumpound shape.
Similarly, unparenting an object from a compound object will cause the child collision shape
to be dynamically removed from the parent shape provided that is was previously added with
setParent.
Note: * This also works if the object is parented to a child of a compound object: the
collision shape is added to the compound shape of the top parent.
* The collision shape is added with the transformation (position, scale and orientation)
it had at the time of the parenting.
* The child shape is rigidly attached to the compound shape, the transformation is not
affected by any further change in position/scale/orientation of the child object.
* While the child shape is added to the compound shape, the child object is removed from
the dynamic world to avoid superposition of shapes (one for the object itself and
one for the compound child shape). This means that collision sensors on the child
object are disabled while the child object is parent to a compound object.
* There is no difference when setParent is used on a non-compound object: the child
object is automatically changed to a static ghost object to avoid bad interaction
with the parent shape; collision sensors on the child object continue to be active
while the object is parented.
* The child shape dynamically added to a compound shape modifies the inertia of the
compound object but not the mass. It participates to collision detection as any other
"static" child shape.
add -nojoystick commandline option: it takes 5 seconds everytime to start the game engine, while there IS no joystick.
In other words: blender -noaudio -nojoystick improves workflow turnaround times for P - ESC from 7 seconds to 1 second!
Improved Bullet soft body advanced options, still work-in-progress. Make sure to create game Bullet soft bodies from scratch, it is not compatible with last weeks builds.
Added Bullet/Gimpact concave collision detection to Blender. If your build system isn't updated yet, please add extern/bullet2/src/BulletCollision/Gimpact/*
This allows moving/dynamic concave triangle meshes (decomposing meshes into compound convex shapes, and using 'compound' shapes is still preferred)
set a fake world transform for game soft bodies, based on center of the AABB, so visiblity and some game logic works. note: this world transform is not smooth.
The Physics button controls the creation of a physics representation
of the object when starting the game. If the button is not selected,
the object is a pure graphical object with no physics representation
and all the other physics buttons are hidden.
Selecting this button gives access to the usual physics buttons.
The physics button is enabled by default to match previous Blender
behavior.
The margin parameter allows to control the collision margin from
the UI. Previously, this parameter was only accessible through
Python. By default, the collision margin is set to 0.0 on static
objects and 0.06 on dynamic objects.
To maintain compatibility with older games, the collision margin
is set to 0.06 on all objects when loading older blend file.
Note about the collision algorithms in Bullet 2.71
--------------------------------------------------
Bullet 2.71 handles the collision margin differently than Bullet 2.53
(the previous Bullet version in Blender). The collision margin is
now kept "inside" the object for box, sphere and cylinder bound
shapes. This means that two objects bound to any of these shape will
come in close contact when colliding.
The static mesh, convex hull and cone shapes still have their
collision margin "outside" the object, which leaves a space of 1
or 2 times the collision margin between objects.
The situation with Bullet 2.53 was more complicated, generally
leading to more space between objects, except for box-box collisions.
This means that running a old game under Bullet 2.71 may cause
visual problems, especially if the objects are small. You can fix
these problems by changing some visual aspect of the objects:
center, shape, size, position of children, etc.