Forum

Logic / Animation Problem?

06 September 2018 17:07
Hi all,



Just getting started with Blend4Web and amazed by some of the possibilities- some amazing work on this forum that's really inspiring - keep it up!

I am trying to get the attached cabinet model to 'disassemble' by opening the doors when the top element is clicked, which (if the logic is correct) should call the animation timeline markers and play the animation of the doors opening. It should then wait until the same item is clicked again, and the next phase of the animation (which is just a mirror of the first) should close the doors and return things to the beginning.

However the animation doesn't seem to work no matter what I do-
have tried default animation on/off, have tried the individual object properties set to animation on/off and all I can get is the signs to be interactive- the animation either doesn't play or just plays in a continuous loop;

How can I fix this?

Blend file attached,



Thanks in advance!
Jamie
06 September 2018 17:27
(attached)
06 September 2018 19:30
It's an honor,

I've always wanted to meet James Cameron!

For your project, first you need to activate the "SELECTABLE" checkbox (in the Object Properties panel) for the element you want to react to clicks.

The other reason it doesn't work is that the Timeline Nodes are for NLA animations, so you need to open the NLA Editor window, scroll to the Empties that have the animations and click their "Push to NLA stack" buttons.



Now the animations will work. Here are some other improvements you could do:

- Your background .hdr file is unsupported and will not show up. Convert it to .png or .jpg.

- You have AREA type lamps in your scene which do not work in B4W. Replace them with other lamp types.

- I'd say your scene is very large (200K+ polygons) for a single object which will be problematic for many user devices; it could also use some clean-up (bad scale, double and loose vertices, wrong normals etc.). Also, you have textures exceeding the 2048 pixel limit. These will not work on many devices, which is why the textures appear RED in the console. Reduce their max. size to 2048 or lower.
Bitmap dimensions for image textures (image width and height in pixels) should be a 2N number, i.e. 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 px. Using textures with other dimensions (so-called NPOT) is supported but is not recommended. Dimensions should be at least 4 pixels for the correct texture compression. Normally square images are used (e.g. 512 x 512 px), however rectangular ones can be used too (e.g. 4 x 128 px). Using images bigger than 2048 px is not recommended.

As a general tip, when you test your projects, always open the browser console and look at B4W's messages which tell you a lot of what needs to be corrected or optimized. The messages are even colored for your convenience (RED means error, YELLOW means warning and so on).
13 September 2018 00:02
Hi Blend4Life,



James Cameron!

Funnily enough my boss in a previous job was actually named James Cameron - I'm Jamie Cameron; his birthday was also the day before mine- what are the odds!

Thanks so much for the help- it was definitely the fact that I hadn't set up the NLA actions, that fixed it

I know this scene is horribly messy- I just thought I'd test it as it lent itself to playing about with some simple logic and getting to grips with Blend4Web,

Looking forward to making more optimised scenes moving forwards, and thanks for the tips - much appreciated!

Jamie
 
Please register or log in to leave a reply.