Page MenuHome

BGE : Support for collision group/mask from the api + activated on EndObject.
ClosedPublic

Authored by Porteries Tristan (panzergame) on Apr 17 2015, 7:45 PM.

Details

Summary

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.

Diff Detail

Repository
rB Blender

Event Timeline

Porteries Tristan (panzergame) retitled this revision from to BGE : Support for collision group/mask from the api..
Porteries Tristan (panzergame) updated this object.

Might also want to make some note somewhere about the modified endObject behaviour,

source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
1109

Can we use Refresh...Controller rather than Update? It's been a while, but when I first tried using refresh... I wasn't checking sleeping.

If the refresh method works, then you can improve performance by copying the code from inside the callback defined in cleanProxyFromPairs to the callback used to activate the bodies in your patch.

1111

This can probably be removed, it's now handled in callback

Porteries Tristan (panzergame) edited edge metadata.

Move CleanPairCallback in CcdPhysicsController.h and remove useless call of activate(true).

Fix bug with collision group/mask in the first frame.

Fix bug with collision group/mask in the first frame, better solution.

Fix bug with collision group/mask in the first frame, better solution.

This is good, let's try and get this pushed!

Fix out of range error message

Mitchell Stokes (moguri) added inline comments.
source/gameengine/Ketsji/KX_GameObject.cpp
2384

There is a constant (MAX_SHORT?) that we should use instead of 65535.

2409

Same as above.

Use constant for max range from climits

@Sergej Reich (sergof), I don't know if this is an area of Bullet you are familiar with at all, but do you have any feedback?

Sergej Reich (sergof) edited edge metadata.

Looks fine to me.
You could probably do the refresh collisions part in different ways but it should be ok if it's really needed.

This revision is now accepted and ready to land.Apr 18 2015, 11:25 AM
Angus Hollands (agoose77) edited edge metadata.

Looks good. Unfortunate that we cannot use cleanProxyFromPairs, but it doesn't seem to have the intended effect here.

Jorge Bernal (lordloki) retitled this revision from BGE : Support for collision group/mask from the api. to BGE : Support for collision group/mask from the api + activated on EndObject..Apr 19 2015, 12:47 AM
Jorge Bernal (lordloki) updated this object.
Jorge Bernal (lordloki) edited edge metadata.
This revision was automatically updated to reflect the committed changes.