Commit Graph

22 Commits

Author SHA1 Message Date
Benoit Bolsee
3ea1c1b4b6 BGE: new sensor object to generalize Near and Radar sensor, static-static collision capbility.
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
2009-05-17 12:51:51 +00:00
Benoit Bolsee
bc355482ab BGE: Keep Sumo and ODE in sync with Bullet at API level, fix a compilation problem in MSVC. 2009-04-14 17:22:14 +00:00
Benoit Bolsee
370850146f BGE patch #18051: add localInertia attribute to GameObject. 2009-04-08 16:25:00 +00:00
Benoit Bolsee
509ca83ef1 BGE patch 18065: gameobj mass writeable + setmass actuator. This patch allows to change the mass of a dynamic or rigid body object during the game. Two methods are available: in a Python script by setting the mass attribute of the game object; by logic brick with the Edit Object->Dynamics->Set Mass actuator. The mass can only be set on dynamic objects and must be a positive floating point value. 2009-01-14 22:33:39 +00:00
Benoit Bolsee
00c12e0906 BGE patch: dynamically update the coumpound parent shape when parenting to a compound object.
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.
2009-01-13 22:59:18 +00:00
Benoit Bolsee
949b6ca80f BGE bug #17688 fixed: Near Sensor Reset not working (for Gamekit)
Implementation of the PHY_IPhysicsController::SetMargin(),
GetMargin(), SetRadius() and GetRadius() for Bullet and Sumo
to allow resetting the Near sensor radius. For bullet use 
the new setUnscaledRadius() function to change sphere radius.

In pPreparation of a Fh constraint actuator:
- Add KX_IPhysicsController::GetRadius()
- Fix implementation of KX_BulletPhysicsController::GetVelocity()
  (velocity at a point in geometric coordinate)
- Don't try to set velocity on static object (Bullet will assert)
- Add KX_GameObject::GetVelocity() for C access to local velocity
2008-10-01 07:55:02 +00:00
Benoit Bolsee
4ae4ecd3ce BGE patch: Optimization of bullet adaptation layer - part 1.
First batch of optimizaton of the bullet adaptation layer in the BGE.
- remove circular motion state update.
- optimization of physic adaptation layer for bullet: bypass
  unecessary conversion of rotation matrix to quaternion and back.
- remove double updates during object replication.
2008-07-21 12:37:27 +00:00
Benoit Bolsee
a397b4b82f BGE bug fix (good for 2.47): SetParent actuator did not work on dynamic objects. Dynamics will now be disabled automatically and the object will be set ghost for the duration of the parenting; this is to avoid static interaction with the parent object. The dynamic state is restored when the parenting is removed with RemoveParent actuator. This fix also applies to setParent() and removeParent() python functions. 2008-07-18 14:40:24 +00:00
Benoit Bolsee
15c105c157 BGE patch: Add damping and clamping option to motion actuator.
This patch introduces two options for the motion actuator:

damping: number of frames to reach the target velocity. It takes
into account the startup velocityin the target velocity direction
and add 1/damping fraction of target velocity until the full 
velocity is reached. Works only with linear and angular velocity.
It will be extended to delta and force motion method in a future
release.

clamping: apply the force and torque as long as the target velocity
is not reached. If this option is set, the velocity specified 
in linV or angV are not applied to the object but used as target
velocity. You should also specify a force in force or torque field: 
the force will be applied as long as the velocity along the axis of
the vector set in linV or angV is not reached. Works best in low
friction environment.
2008-06-24 19:37:43 +00:00
Chris Want
5d0a207ecb Patch from GSR that a) fixes a whole bunch of GPL/BL license
blocks that were previously missed; and b) greatly increase my
ohloh stats!
2008-04-16 22:40:48 +00:00
Erwin Coumans
46234f90ce Removed old Blender/extern/bullet, and upgraded game engine to use Bullet 2.x
All platforms/build systems: either upgrade to use extern/bullet2, or disable the game engine until the build is fixed.
2006-11-21 00:53:40 +00:00
Erwin Coumans
ec8448b88d bugfix/workaround for problem with hard-coded collision margins being too large. 2006-06-18 22:10:00 +00:00
Kester Maddock
c844aa265a Big patches:
Erwin Coumans: Abstract the physics engine
Charlie C: Joystick fixes
Me: Moved the ray cast (shadows, mouse sensor & ray sensor)
2005-03-25 10:33:39 +00:00
Kester Maddock
a96869198b Rigid body physics for non spherical bounding objects.
If your simulation becomes unstable, crank up the 'Form' control.

Removed Solid from class SumoPhysicsEnvironment (since it wasn't actually used.)
2004-04-14 05:57:24 +00:00
Kester Maddock
5398f1ba77 Added resolveCombinedVelocities()
Fixed drot actuator.  The rotation matrix was being mutilated by passing a float[9] instead of float[12].
2004-04-08 11:34:50 +00:00
Nathan Letwory
00291b5cf4 [GameEngine] Commit all Kester's changes made to the gameengine to restore 2.25 like physics.
[SCons] Build with Solid as default when enabling the gameengine in the build process
[SCons] Build solid and qhull from the extern directory and link statically against them

That was about it.

There are a few things that needs double checking:

* Makefiles
* Projectfiles
* All the other systems than Linux and Windows on which the build (with scons) has been successfully tested.
2004-03-22 22:02:18 +00:00
Kent Mein
f1c4f705a1 Removed the config.h thing from the .h's in the source dir.
So we should be all set now :)

Kent
--
mein@cs.umn.edu
2002-12-27 13:11:01 +00:00
Kent Mein
b9a19f1ea7 Did all of the .h's in source
(adding)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

also the Makefile.in's were from previous patch adding
the system depend stuff to configure.ac

Kent
--
mein@cs.umn.edu
2002-11-25 11:16:17 +00:00
Maarten Gribnau
2d5514be28 Brought back the sumo physics controllers and undid game engine make file
changes.
Instead modified the top level nan_definitions.mk to point the NAN_SUMO and
NAN_FUZZICS to the right locations.
Maarten
2002-11-05 20:20:50 +00:00
Maarten Gribnau
c458cc7310 Forgot to remove sumo physics controllers
Maarten (mail@maartengribnau.com)
2002-11-04 21:47:37 +00:00
Kent Mein
01bff70383 fixed spacing in the headers to get rid of some warnings and some other
little minor spacing issues.
2002-10-30 02:07:20 +00:00
Hans Lambermont
12315f4d0e Initial revision 2002-10-12 11:37:38 +00:00