Prevent vertex groups in the same mesh touching

05 April 2016 11:42
I have a simple cylinder mesh. It has a 'hole' cut through it using through it (using knife project). The vertices which form the top face of the cylinder are grouped as 'Top'. The vertices which form the hole are grouped as 'Hole'.

I have an armature with bones called 'Top' and 'Hole', so that in b4w I can grab the top and adjust the length of the cylinder, and I can grab the hole and slide it along the cylinder.

But I can't find a way to prevent the hole getting 'outside' - beyond the top of - the cylinder.
All I need to do (afaics) is detect the proximity of 'Top' and 'Hole' bones and react
by preventing any further movement.

In blender I can't set collision bonds on individual bones, only the armature as a whole, so the bones wont collide with each other. I can't use multiple armatures because b4w will only load the first one.
Any ideas please? TIA Phil

06 April 2016 12:11

Any ideas please? TIA Phil
I can't understand well how you will move your bones, but may be this setup can help you.
Blend4web and that kind of thing.
06 April 2016 13:37
Thanks for that Mikhail, but I'm afraid I can't understand how it helps. I see that your top bone is constrained by the cube, but I can't see how that helps to detect collisions?
I've enclosed by blend file - should probably have done that to start with!

As you see the TopHole bone can 'slide' the hole along the cylinder, but I can't see how to prevent it moving beyond the top. The same issue applies to "Top" bone, which can adjust the length of the cylinder so that again, the hole is beyond the end of the cylinder.

In blender, I believe I could prevent that it by using 2 armatures and setting up their collision bounds, but b4w won't load the second armature.

I'm actually moving the bones in b4w using a bit of javascript to call set_bone_tsr() to manipulate their positions. I've used your "Furnishing a room" example as a start point, but I run into trouble because the code…

var objs = m_scenes.get_all_objects("ALL");
for (var i = 0; i < objs.length; i++) {
var obj = objs;

..doesn't find the individual; bones, just the armature. So I can't detect bone collisions. Any ideas please? TIA Phil

06 May 2016 19:05
In such cases it is a good idea to just use the armature.get_bone_tsr method and block unwanted translations if bone position is close to some limit. This approach is much faster than physics one.
Please register or log in to leave a reply.