Forum

Best way to create user interfaces with logic

I'm trying to create a user interface that appears per logic triggers and camera placement.

1 ) Simple creating a cube to appear in front of the camera after its movement results in the cube not faced properly. Its basically impossible to place the cube exactly as it should be to display text and buttons to the user.

2 ) We've also tried parenting a cube to the camera, this worked much better for alignment but the shapes are not consistent with the initial desired shape. They are much smaller once rendered.

3 ) Can someone help us understand why our attempts result in such unexpected ways and also recommend methods to create user interfaces that work well with blender logic?

Thanks again.

UPDATE:Not sure if it's a bug or what but we've gone ahead and built our block "UI" with the parenting to camera method in a completely separate file. Then copy and pasted it into our working project and it is rendering fine. Why would we have to build each part separately, then combine them to work?

1)Best way to make user interface it's to use HTML coding over the blend4web 3d viewer.

2)But you can do this: place all your buttons and interface elements in the center of the scene. divede it on elements that must be connected to the front of the camera, then to the left of the camera and so on. Then creade groups like fron, top, left etc, add all elements by groups and then create dupli-groups using this groups. Each Empty objects with dupli-group parent to camera ant set our Blend4Web type of aligment object to the camera. Also need to do clear parent invers of each paranted Empty obcts. Also all scales and rotations must be allpied to inteface elements and objects.Read about parenting aligment in our documentation.

Thanks for responding, I know it's late in Russia. There is no scale on the camera. It's actually a pretty simple project file but I believe we are definitely seeing bug like behavior where building each part separately and bringing it into the main project works when building these things in place does not work.

Thanks for your response on 2: but we're having trouble understanding. Are there any resources for your ideas?

1)create buttons2)place them in one plane3)add them to group ctr_g4)create Empty with dupli-group ctr_a>group_instance5)parent this empty to capera ctr_p6)clear parent inverse from empty alt_p>clear_parent_invers7)setup alighment on camera in object preferences8)choose aligment (for exmaple bottom_right)9)set distance to 1 (for example)10)push Fit_to_camera to see how it will look like in engine

Also can you share with us your blend file with example where bug take place?

I really liked this button creation technique for a user interface. It was perfect here in my project, but I'm having a difficult to assign logic nodes to these empty elements. I'm trying to use inherit material node to modify the color of an object.. How I can do this? Would it be possible only with the use of programming code?

You might want to assign your logic nodes to the actual button object, not the empty it is parented to.For material color, see the Material Code Snippet example.There is a "View Code" button at the bottom left.

The objects 1, 2, 3 and 4 are the empty. (they change the color of building facade on mouse click)The actual buttons are Plane.098, Plane.099, Plane.100 and Plane.101.

If your buttons inside of dupli group at first you need to select an empty of dupli group object then object (plane) inside of it. If your button (plane) only parented to object you need to choose only the button (plane) in the switch select node without an empty to which you parented the button.