Page MenuHome

Support limiting collisions by group for softbody and particles.
ClosedPublic

Authored by Alexander Gavrilov (angavrilov) on Jul 18 2016, 5:20 PM.

Details

Summary

This feature is extremely useful for layering multiple cloth objects,
and there is no reason there shouldn't be the same kind of feature
for softbody. Particles are likely to have a use for this too, and
implementing it there is even easier as the code almost supports it.

  • Support specifying collision objects for softbody via a Group.

    Layers are clumsy and limited: e.g. it's impossible to make A collide with B, but not B with A. There are also only 20 of them. Most of other physics systems already support using explicit object groups for this function instead.

    Softbody code for the no group case is deliberately not refactored to reduce duplication, so that it's obvious that when the group is not set, nothing changes in its behavior.
  • Support specifying collision objects for particles via a Group

    This is even easier than with softbody, because the underlying code already almost supports it: all that's missing is a field and UI.

Diff Detail

Repository
rB Blender
Branch
collision-groups
Build Status
Buildable 68
Build 68: arc lint + arc unit

Event Timeline

Alexander Gavrilov (angavrilov) retitled this revision from to Support limiting collisions by group for softbody and particles..
Alexander Gavrilov (angavrilov) updated this object.
This revision is now accepted and ready to land.Jul 28 2016, 10:35 AM
Alexander Gavrilov (angavrilov) edited edge metadata.

Add expand_doit calls in readfile.c to match linking fixes in rB8e004062612e.

Lukas Tönne (lukastoenne) edited edge metadata.

Apart from possible code style tweak, lgtm.

source/blender/blenkernel/intern/softbody.c
516

In terms of code style, would prefer two distinct functions, since it's either group-based collision or layer-based, but not both. Having a return in the middle of a function after lots of code can be misleading.

But not mandatory, depends on surrounding code style here ...

Alexander Gavrilov (angavrilov) edited edge metadata.

Change softbody code to avoid weird return and slightly reduce duplication,
while still making it obvious that nothing changes in the no group case.