User posts phil.robinson
28 June 2016 13:11
Incidentally, if you want to have perfect English, your sig should really be
"Blend4web and that kind of thing"
"Blend4web and those kinds of things"
because 'that' is singular, but 'things' is plural.
Hope it helps - Thanks again, Cheers, Phil

28 June 2016 13:07
Thanks Mikhail; I finally got around to trying this and it works! Can't say I understand it but I'm used to that! Thanks again, Phil
09 June 2016 12:55
That was fast, thanks.

Like this you mean?
I've put some loop cuts around the hole, and that does constrain the weirdness to the area between the hole and the loop cuts, but it's still there and very visible.

I think maybe I didn't understand you right?
Thanks again, Phil Robinson
09 June 2016 11:27
If you 'fast preview' the enclosed blend with 'export shape keys' turned off for cube.001, it behaves as I would expect.

With 'export shape keys' turned on however, the shape key ' Big' works just fine, but all sorts of extra curves and distortions appear on the faces of the mesh. Any idea why and what I can do to stop it? All that _should_ happen is that the shape key adjusts the diameter of the hole.
TIA Phil Robinson
27 May 2016 12:45
> 1)you need to parent on each bone only one corner and move two bones at the same time. So there will be only one bones
> on each vertex group.

I feel completely stupid for not thinking of that. Thanks so much.

> 2)Also you need to parent collision boxes to the bones: for holes and corners and detect collisions between then
> using phisics.
Yes; once the vertices are following the bones properly, I could indeed do that. Actually though, I
already have working code to detect bone collisions, so I think I'll stick with it as it makes the
models simpler, but thanks again. Your support is really fantastic for a free api. Cheers, Phil

26 May 2016 17:05
Thanks Mikhail

OK, more info …

Take a look at:
I've uploaded the blend file for it here.

Also, there is a bit of js which is configured to know which bones
can be moved in what directions.

As you see, the idea is that you can adjust the dimensions of the plate
and the positions of the holes, but the holes must stay inside the plate.

A plate edge can be adjusted with the sliders, and when it gets to within a
set distance of the holes, my code detects the fact using get_bone_tsr() and
prevents further movement.

But that doesn't work properly when you adjust the holes positions because
the bones are not in the same place as the vertex groups they are parented
to, because the vertices are being influenced by more than 1 bone, so a (eg) a
1 unit movement of the bone doesn't result in a 1 unit movement of the vertex
group it controls.

That's why I tried parenting a mesh to the vertex group instead, so I could then
detect the position using m_transform.get_translation() instead; unfortunately, as
you say, that's not supported by b4w so that doesn't work either.

(To see this go wrong, make the length or width bigger with the slider, then adjust
the holes 'outwards' too. They will go outside the plate.)

Can you think of a way to do this? It's basically just collision detection, so I hope
I'm missing something obvious?

Thanks, Phil
24 May 2016 19:31
Ah ok thanks, I was beginning to suspect so.

Here's what Im trying to do; maybe you can suggest a method?

I have an aplication in js using your api. I want to be able to adjust the dimensions of the 'cube' and restrict them according to various formulas.

I can add bones to the mesh so that the faces of the mesh 'follow' the bones and that adjusts the shape exactly as I want, but how can i restrict the length, width and depth according to my needs?

To do so, I need to know where each face _is_ so i can work out if it's allowed or not.

I can't just use the bone positions as the vertex groups they control are influenced by more than one bone, so the bones move further than the vertices. I can't find a way to discover the position of the vetices themselves, and I can't parent another object to a vertex thern find out where that is. I'm out of ideas! Can you think of a way to do this?

All it amounts to is: how can I find out via the api where a face/vertex/vertex group is? Thanks again for your help. Phil
22 May 2016 14:38
(I'm pretty sure this is a much simplified version of my previous "absolute vs relative positions" question.)

Load the enclosed blend file, do a 'fast preview'.

Why does the red plane appear in the wrong place and is there a way to fix it - i.e. make it show up in the same place it does in blender?
TIA Phil Robinson

21 May 2016 18:12
Here's a blend file, the json and bin files exported from it, and a slightly modified version of your starter program which just loads it and prints some diagnostics.

I want to get the absolute position of the "Right_limiter" object
which ought, I think, to be 5,0,0, but …

… all return the same (wrong) thing.

Right_limiter get_translation @     0,-0.20000000298023224,-2
Right_limiter get_translation_rel @ 0,-0.20000000298023224,-2
Right_limiter get_tsr @ 0,-0.20000000298023224,-2,1,0,0,0,1
Right_limiter get_tsr_rel @ 0,-0.20000000298023224,-2,1,0,0,0,1
Right_limiter get_object_center @ -0.0660799965262413,-0.20000000298023224,-1.9314600229263306

I must be missing something obvious but what? Even if there's a "user too stupid" error here, surely the "_rel" versions should produce a different result from the non "_rel" ones?
TIA Phil Robinson

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