Currently we can't update the physics mesh of an added rigid body.
The cause is that that we need to update all shapes to say that the mesh was changed, for static object we don't do that previously because we use a odd way to reallocate memory at the same place.
So now when a mesh is changed we iterate all physics controllers which use the same shape info and recreate its shape with the correct mesh.
example file : {F168100}
Reviewers: scorpion81, sergof, hg1, sybren, moguri, agoose77
Reviewed By: moguri, agoose77
Subscribers: sybren
Differential Revision: https://developer.blender.org/D1269
It fix some mistakes in b5e96530353ef22d184a60cd2b59a5e451ee211f and made a more safety behavior for collision callbacks used in compound controllers during adding and removing.
Replace EnableCcdPhysicsController by AddCcdPhysicsController and DisableCcdPhysicsController by RemoveCcdPhysicsController.
Tested with compound shapes and collision sensors.
Reviewers:agoose77, ideasman42
Currently there are bugs with physics objects in inactive layers,
character and softbody.
I added a function in CcdPhysicsEnvironement to know if a physics
controller is currently active and for soft body I added the correct function in UpdateCcdPhysicsController to re-add a softbody in the dynamics world.
The bug was introduced in D1243 commit 3d55859
Reviewers: hg1, scorpion81, lordloki, moguri, agoose77, sergof
Reviewed By: sergof
Subscribers: youle, moguri
Differential Revision: https://developer.blender.org/D1253
A Python API for the collision group / mask has been added:
```
KX_GameObject.collisionGroup
KX_GameObject.collisionMask
```
The maximum number of collision groups and masked has been increased from eight to sixteen.
This means that the max value of collisionGroup/Mask is (2 ** 16) - 1
EndObject will now activate objects that were sleeping and colliding with the removed object.
This means that, unlike now, if a rigid body starts sleeping on top of another object, when the latter is removed the rigid body will activate and fall, rather than float midair as before.
Collision groups that do not intersect used to collide on the first frame. Now this has been fixed so that they collide appropriately.
Thanks to agoose77 for his help.
Reviewers: scorpion81, hg1, agoose77, sergof
Reviewed By: agoose77, sergof
Subscribers: sergof, moguri
Projects: #game_physics, #game_engine
Differential Revision: https://developer.blender.org/D1243
This is a new KX_GameObject attribute that it increments the
possibilities of optimization during the game
Additionally the unused m_bSuspendDynamics variable is removed.
Reviewers: moguri, agoose77, lordloki
Reviewed By: agoose77, lordloki
Subscribers: agoose77, lordloki
Differential Revision: https://developer.blender.org/D1091
This patch will add a physics constraints replication for group instances
(dupli group).
It also fix crashing when when a group instance is made from a linked
group instance and both are on the active layer.
Initial patch T31443 from moerdn (Martin Sell).
Reviewers: lordloki, sergof, moguri, sybren
Reviewed By: moguri, sybren
Differential Revision: https://developer.blender.org/D658
Two areas of the BGE use a hard-coded 60 Hz as frame rate. However, this 60 Hz is just a default setting, and can be changed in the Blender interface.
This setting is now used instead of the hard-coded 60 Hz.
CcdPhysicsEnvironment::SetFixedTimeStep() is actually never called, as we don't even support a true fixed-timestep simulation.
Blender allows you to create a constraint without specifying its reference
object, even when the constraint requires such a reference. The BGE would
crash on this. This change simply ignores such a constraint.
Deleting an object was deleting all rigidbody constraints in the scene.
Bug was introduced with D701.
Reviewers: agoose77, sergof, moguri, lordloki, sybren
Reviewed By: lordloki, sybren
Subscribers: sybren, hbar, blueprintrandom, sergof, agoose77
Differential Revision: https://developer.blender.org/D1007
Null check to verify that parent has a character controller. Otherwise (i.e empty) it will crash.
Reviewers: moguri, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D1115
This patch adds two parameters to the functions in the
collisionCallbacks list. The callback function should thus be like
this:
```
def on_colliding(other, point, normal):
print("Colliding with %s at %s with normal %s" % (other, point, normal))
game_ob.collisionCallbacks.append(on_colliding)
```
The `point` parameter will contain the collision point in world
coordinates on the current object, and the `normal` contains the
surface normal at the collision point.
The callback functions are checked for the number of arguments
`co_argcount`. The new `point` and `normal` arguments are only passed
when `co_argcount > 1` or when `co_argcount` cannot be determined.
Reviewers: brita_, campbellbarton
Subscribers: sergey, sybren, agoose77
Projects: #game_physics
Differential Revision: https://developer.blender.org/D926
Red was used with different semantics in the physics visualisation,
switching to yellow to prevent confusion.
A screenshot can be found at http://www.pasteall.org/pic/80766 -- it's
the yellow balls + lines.
Reviewers: brita_, lordloki, campbellbarton
Reviewed By: lordloki, campbellbarton
Subscribers: lordloki
Projects: #game_physics
Differential Revision: https://developer.blender.org/D925
A screenshot can be found at http://www.pasteall.org/pic/80766 -- it's the yellow balls + lines.
Reviewers: brita_, lordloki, campbellbarton
Reviewed By: lordloki, campbellbarton
Subscribers: lordloki
Projects: #game_physics
Differential Revision: https://developer.blender.org/D925
Refactored some code to be easier to read. Semantically the code is
identical.
- Some conditions were negated to be able to return/continue early,
rather than having the majority of the code inside an if-body.
- Conditions were simplified (!(a == b)) turned into (a != b);
repeated conditions calculated only once.
- Unnecessary variables and one unnecessary condition were
eliminated.
Reviewers: campbellbarton, lordloki
Reviewed By: lordloki
Projects: #game_physics
Differential Revision: https://developer.blender.org/D954
This patch adds the following R/W properties and method to `KX_GameObject`:
- `linearDamping` -- get/set linear damping
- `angluarDamping` -- get/set angular damping
- `setDamping(linear, angular)` -- set both simultaneously
These allow runtime changes to the same properties that are accessible at design time in Blender's UI via `game.damping` and `game.rotation_damping`. The names of the properties were chosen to mirror the internal names of the BGE physics engine, as these are (AFAIK) also the commonly used names in physics literature.
Reviewers: campbellbarton
Projects: #game_physics
Differential Revision: https://developer.blender.org/D936
Fix for T41294.
Rigid body constraints are not deleted, if the corresponding game objects are deleted.
Reviewers: moguri
Differential Revision: https://developer.blender.org/D701
1. Add attribute to get the constraint type.
2. Add missing documentation for getParent, setParam, constraint_id in bge.types.KX_ConstraintWrapper.rst.
3. Add missing documentation for GENERIC_6DOF_CONSTRAINT and flag bit in bge.constraints.rst.
4. Fix typo in CcdPhysicsEnvironment.cpp
Reviewers: moguri
Reviewed By: moguri
Differential Revision: https://developer.blender.org/D654
This is related to task T29419. Credit also goes to Goran Milovanovic
(goran) for proposing an initial fix for this issue.
The issue is the current behavior of applyImpulse doesn't match the behavior
described in the documentation as instead of a impulse point in world coordinates,
it seems to require a coordinate in a local space.
Additionally, applyImpulse function isn't consistent with similar functions (applyForce, applyTorque, etc)
as it doesn't allow to choose in which space (local or global) the impulse is applied.
Now, we have the following function:
applyImpulse(point, impulse, local=False)
being "point" the point to apply the impulse to (in world or local coordinates). When local is False will
have both point and impulse in World space and when local is True will have point and impulse in local space.
Reviewers: moguri, dfelinto, brita_
Reviewed By: moguri
Differential Revision: https://developer.blender.org/D567
The Bullet 2.82 update uses a different method for ray casting that
seems incompatible with our older files. So, for now we just force the
vehicle physics to use the older ray casting method.
I'm not sure why this function ever increased the object's refcount. Any
place in the code that calls KX_GameObject::GetParent() has to turn
around and call parent->Release(). Forgetting to call Release() was a
common cause of memory leaks (in fact, KX_SteeringActuator was probably
leaking). If the refcount needs to be increased, the calling code can
handle calling AddRef().
* Moving the BlenderDebugDraw (derived from btIDebugDraw) from
KX_BlenderSceneConverter to CcdPhysicsEnvironment
* Moving CcdPhysicsEnvironment initialization to CcdPhysicsEnvironment
(this could probably be cleaned up some more with some sort of
factory, or at least moving code to CcdPhysicsEnvironment's
constructor)
* Simplifying physics environment initialization (went from two
switches to one)
The vehicle constraint is now properly removed if bge.constraints.removeConstraint()
is used or the object is deleted. This also fixes a memory leak with the
vehicle wrapper.