Commit Graph

22 Commits

Author SHA1 Message Date
Benoit Bolsee
bf0440add8 BGE bug fix (continuation of previous bug fix):
- Forgot to make SCA_ISensor::UnregisterToManager() virtual to intercept active-inactive transition on collision sensor to clear colliders reference.
- Don't record collision on inactive sensor. 
  This situation occurs when an object with an inactive collision sensor collides with an object with an active collision sensor: the collision handler triggers both sensors.
  The result of this bug was pending references that eventually cause temporary memory leak (until the sensor is reactivated).
2008-10-17 09:24:35 +00:00
Campbell Barton
3ec4f674d0 Python 2.4 should build with the game engine now, no thanks to python for switching from char to const char 2008-10-02 00:22:28 +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
8a8a12ed84 BGE patch: logic optimization part 2: remove inactive sensors from logic manager.
With this patch, only sensors that are connected to 
active states are actually registered in the logic
manager. Inactive sensors won't take any CPU,
especially the Radar and Near sensors that use a
physical object for the detection: these objects
are removed from the physics engine.

To take advantage of this optimization patch, you
need to define very light idle state when the 
objects are inactive: make them transparent, suspend
the physics, keep few sensors active (e,g a message
sensor to wake up), etc.
2008-07-30 17:41:47 +00:00
Benoit Bolsee
e433719f51 BGE bug fix (good for 2.47): radar and near sensor did not filter correctly the collisioning objects based on ACTOR flag when the parent object was added dynamically. This could result in a very big performance decrease. 2008-07-15 18:57:10 +00:00
Benoit Bolsee
70d239ef7d BGE logic update: new servo control motion actuator, new distance constraint actuator, new orientation constraint actuator, new actuator sensor.
General
=======
- Removal of Damp option in motion actuator (replaced by
  Servo control motion).
- No PyDoc at present, will be added soon.

Generalization of the Lvl option
================================
A sensor with the Lvl option selected will always produce an 
event at the start of the game or when entering a state or at 
object creation. The event will be positive or negative 
depending of the sensor condition. A negative pulse makes
sense when used with a NAND controller: it will be converted
into an actuator activation.

Servo control motion
====================
A new variant of the motion actuator allows to control speed 
with force. The control if of type "PID" (Propotional, Integral, 
Derivate): the force is automatically adapted to achieve the 
target speed. All the parameters of the servo controller are
configurable. The result is a great variety of motion style: 
anysotropic friction, flying, sliding, pseudo Dloc...
This actuator should be used in preference to Dloc and LinV
as it produces more fluid movements and avoids the collision 
problem with Dloc.
LinV : target speed as (X,Y,Z) vector in local or world 
       coordinates (mostly useful in local coordinates).
Limit: the force can be limited along each axis (in the same
       coordinates of LinV). No limitation means that the force
       will grow as large as necessary to achieve the target 
       speed along that axis. Set a max value to limit the 
       accelaration along an axis (slow start) and set a min
       value (negative) to limit the brake force.
P:     Proportional coefficient of servo controller, don't set
       directly unless you know what you're doing.
I:     Integral coefficient of servo controller. Use low value
       (<0.1) for slow reaction (sliding), high values (>0.5)
       for hard control. The P coefficient will be automatically
       set to 60 times the I coefficient (a reasonable value).
D:     Derivate coefficient. Leave to 0 unless you know what
       you're doing. High values create instability. 

Notes: - This actuator works perfectly in zero friction 
         environment: the PID controller will simulate friction
         by applying force as needed.
       - This actuator is compatible with simple Drot motion
         actuator but not with LinV and Dloc motion.
       - (0,0,0) is a valid target speed.
       - All parameters are accessible through Python.

Distance constraint actuator
============================
A new variant of the constraint actuator allows to set the
distance and orientation relative to a surface. The controller
uses a ray to detect the surface (or any object) and adapt the
distance and orientation parallel to the surface.
Damp:  Time constant (in nb of frames) of distance and 
       orientation control.
Dist:  Select to enable distance control and set target 
       distance. The object will be position at the given
       distance of surface along the ray direction.
Direction: chose a local axis as the ray direction.
Range: length of ray. Objecgt within this distance will be 
       detected.
N    : Select to enable orientation control. The actuator will
       change the orientation and the location of the object 
       so that it is parallel to the surface at the vertical
       of the point of contact of the ray.  
M/P  : Select to enable material detection. Default is property
       detection.
Property/Material: name of property/material that the target of
       ray must have to be detected. If not set, property/
       material filter is disabled and any collisioning object
       within range will be detected.
PER  : Select to enable persistent operation. Normally the 
       actuator disables itself automatically if the ray does
       not reach a valid target. 
time : Maximum activation time of actuator. 
       0 : unlimited.
       >0: number of frames before automatic deactivation.  
rotDamp: Time constant (in nb of frame) of orientation control.
       0 : use Damp parameter.
       >0: use a different time constant for orientation.

Notes: - If neither N nor Dist options are set, the actuator
         does not change the position and orientation of the
         object; it works as a ray sensor.
       - The ray has no "X-ray" capability: if the first object
         hit does not have the required property/material, it
         returns no hit and the actuator disables itself unless
         PER option is enabled.
       - This actuator changes the position and orientation but
         not the speed of the object. This has an important 
         implication in a gravity environment: the gravity will
         cause the speed to increase although the object seems
         to stay still (it is repositioned at each frame).
         The gravity must be compensated in one way or another.
         the new servo control motion actuator is the simplest 
         way: set the target speed along the ray axis to 0
         and the servo control will automatically compensate 
         the gravity.
       - This actuator changes the orientation of the object 
         and will conflict with Drot motion unless it is 
         placed BEFORE the Drot motion actuator (the order of 
         actuator is important)
       - All parameters are accessible through Python.

Orientation constraint 
======================
A new variant of the constraint actuator allows to align an
object axis along a global direction.
Damp : Time constant (in nb of frames) of orientation control.
X,Y,Z: Global coordinates of reference direction. 
time : Maximum activation time of actuator. 
       0 : unlimited.
       >0: number of frames before automatic deactivation.  

Notes: - (X,Y,Z) = (0,0,0) is not a valid direction
       - This actuator changes the orientation of the object
         and will conflict with Drot motion unless it is placed
         BEFORE the Drot motion actuator (the order of 
         actuator is important).
       - This actuator doesn't change the location and speed. 
         It is compatible with gravity.
       - All parameters are accessible through Python.

Actuator sensor 
===============
This sensor detects the activation and deactivation of actuators 
of the same object. The sensor generates a positive pulse when 
the corresponding sensor is activated and a negative pulse when 
it is deactivated (the contrary if the Inv option is selected). 
This is mostly useful to chain actions and to detect the loss of 
contact of the distance motion actuator.

Notes: - Actuators are disabled at the start of the game; if you
         want to detect the On-Off transition of an actuator 
         after it has been activated at least once, unselect the
         Lvl and Inv options and use a NAND controller.
       - Some actuators deactivates themselves immediately after 
         being activated. The sensor detects this situation as 
         an On-Off transition.
       - The actuator name can be set through Python.
2008-07-04 08:14:50 +00:00
Benoit Bolsee
b0049e6088 fix BGE bug #8094: Collision sensor on child object makes the object rotate or move very fast. Collision sensor can now be set on child object without side effect. 2008-04-19 21:09:40 +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
Benoit Bolsee
3cf5b1d6fb Radar/Near sensor performance problem fixed 2008-03-01 19:17:37 +00:00
Erwin Coumans
2ec5d00da9 fixed some motionstate synchronization issues
nearsensor was not synchronized at the start
wheels not synchronized properly (one frame delay)
2006-12-04 04:13:42 +00:00
Erwin Coumans
ab71e2a9b5 -added basic support for GameActuator 'load game', relative paths were broken, just load file into memory and load blend from memory.
-near sensor support
- python binding for PhysicsConstraints.setNumTimeSubSteps (dividing the physics timestep to tradeoff quality for performance)
2006-05-22 21:03:43 +00:00
Erwin Coumans
65a52fc419 - prepared for automatic game physics -> animation (ipo) conversion (this allows to use bullet for animation)
- default the m_edgecode to 65535, the wireframe was invisible. when is the edgecode available again ?
- added an extra condition, nearsensor is not yet working for bullet, but it crashed.
2005-08-22 15:47:56 +00:00
Jean-Luc Peurière
f38e0686d9 new round of warning fixes. we are now down to 24 with Xcode on blender
alone with the following flags :
-Wall -Wno-char-subscripts -Wno-missing-braces.

the only one still worrying me is in rand.c line 57 :

rand.c:57: integer constant is too large for "long" type

but i have no clue about how correct cross-compiler and 32/64 bits friendly

see also my mail to commiter list for signed/unsigned issues
2005-06-04 16:22:50 +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
Jean-Luc Peurière
c78e44cdc5 big warning hunt commit
lot of casts, added prototypes, missing includes and some true errors
2005-03-09 19:45:59 +00:00
Kester Maddock
38b993f787 Speed up the physics engine: hook the SOLID broad phase, so we can either reject the test or request the penetration depth test as necessary. Previously we were doing the penetration depth test, as well as SOLID's intersection test. 2004-11-06 04:58:10 +00:00
Kester Maddock
baa2f99f07 Port Python updates from Tuhopuu2:
getType/setType to action/sound actuator (sgefant)
Use a more generic python -> math conversion.
2004-07-17 05:28:23 +00:00
Kester Maddock
2fd6e72851 Changed Python _getattr/_setattr methods to use const STR_String& instead of char* - makes using these methods much nicer. 2004-05-16 13:05:15 +00:00
Kester Maddock
ae9233a5b0 1. Check material names passed to the physics engine (for collision sensors.)
Consider:
gameobj->getClientInfo()->m_auxilary_info = (matname ? (void*)(matname+2) : NULL);
It works if matname is "MAblah", but not if matname is "".

2. Added constructor for struct RAS_CameraData.
3. Added initializers to the struct KX_ClientObjectInfo constructor
4. Collision sensors won't detect near sensors.
5. A stack of minor tweaks, adjusting whitespace, using ++it for stl stuff.
2004-04-11 02:50:02 +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
209a2ede2c Last of the config.h mods...
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

added to these files.

Kent
--
mein@cs.umn.edu
2002-11-25 15:29:57 +00:00
Hans Lambermont
12315f4d0e Initial revision 2002-10-12 11:37:38 +00:00