December 8, 2012
So as I previously mentioned, multi-directional constraints can be achieved by invalidating the transforms. What I did’nt mention is that its pretty damn hard mixing up a group constraint mechanic with a non-group mechanic.
I’m resolving myself to have either one or the other, i.e a single object that can switch to multiple parents, or a group of objects that can share/switch to a single parent. With the group method I need to tweak some things and wrap the switching into a simple function. The structure basically looks/acts like this.
We have a switch attribute, that basically stores its targets, and index of target to switch to. The last target is deemed the world or invalidation target (unless i expose it for change). The reason for this if we have two objects A and B, with both in each others targets we need to invalidate one when it tries to switch to itself. We also need to switch that first E.g.
- A, B both have each others targets, both set to world.
- B switches to A, A is still set to world – the link is fine.
- A switches to B – the causes circular dependency.
So to fix this we walk the controllers and determine which will be invalidate, in this case B trying to connect to B will invalidate itself automatically to the world, allowing A to happily connect to it.
Why is this nice, well the core doesn’t change at all. All we need to build is a check for invalidation based on the index, invalidate and switch in the correct order.
Essentially a switch-box for switches.