Forum

Static scene menu panel to show/hide elements

06 December 2016 18:30
MK
Hello,

I'm new to blend4web and would like to know best practices for the creation of scene menu panels for scene interaction. I've created a mathematical model for demonstration purposes and would like to let the scene user switch components on and off preferably with a menu panel (html-based or rendered).

Can I achieve this without digging deeper into the coding mechanics by using Blender only? I created a button by parenting it to a camera, set "Viewport Align" and added some logic nodes. This does not really work as the button seems to be way to large (nearly fills screen) even if it's small in the Blender viewport.

Any help would be very appreciative.
- Marcel
06 December 2016 19:20
Hello and welcome to our forum!

Try selecting the button and applying scale (ctrl+a -> Scale)

If it won't help, please attach the .blend file to the message here, we'll look into it
08 December 2016 13:20
MK
Hello Pavel,

thx for the welcome and tips. :)

I could build a small menu by inserting an empty object, parenting it to the camera and add the menu buttons to the empty object as child elements. Now the buttons are always at the same position.

Is it possible to easily align my navigation buttons to the cameras view direction? I'm struggling the correct position/rotation.
08 December 2016 14:59
Your method seems to work just fine to me:

parnt.blend
parnt.html

Or you wanted to animate the menus?
08 December 2016 16:21
MK
Thx a lot - I switched to planes instead on cubes for buttons and this makes things a lot easier.

My first attempt to reproduce your scenario resultet in the scaling issue first mentioned. After having applied the scale of the object with Ctrl+A everything looked exactly like in Blender. What does this "apply scale" exactly do? The internet blogs/forums are a bit misleading sometimes.
08 December 2016 17:10
Blend4Web doesn't suppors non-uniform scaling. For example, the scale of an object(XYZ) can be 1; 1; 1 or 0,3; 0,3; 0,3 but not 1, 3, 2.

The scaling works on object only, not touching the mesh itself. And when you apply scale it applies it to the mesh - and drops Scale parameter back to normal (1, 1, 1).

Some modifiers can broke if the scaling is not 1, 1, 1 (like Bevel)

The same is with applying location and rotation.
08 December 2016 17:46
MK
Excellent, thx for clarification! :)
09 December 2016 11:44
Maybe you already did this, but this is how I line things up.
See attached image.
If you want to line things up in the top, left corner, lay out your UI objects and line them up with each other. Set your camera to look at them how you want.
Then set the 3D cursor a little above and to the left of your group.
Go to Object > Transform > Set Origin to 3D Cursor. Do this for each object in your UI.
When you set these objects as UI element on your camera, this origin point will be in the top left corner and each of the objects will be in their relative positions. You only need to apply scale if you change size on one axis. For example if you select all of your UI elements and scaled them up or down, you would not need to apply scale
12 December 2016 12:35
MK
Hello Will,

thank you! I did not do it that way but I'll definitely adopt it.
 
Please register or log in to leave a reply.