How to use the mouse coordinates to manipulate objects

28 May 2017 22:37
Hi there,

It's my first question on this forum so, I don't know if it's the right place to post my question.

First of all you guys rock ! Seriously ! I already created something cool with your features, always in logic nodetree sure . And now that I need to code a little Javascript, I can't understand it to modify it as I need.

I tried to understand it here :
and then here :

But I can't and I was trying to do a sliding menu that would be sliding as the mouse clics on any item of the menu. Like that, if I clicked on "clic01" button then that button and all the other buttons will be moving up and down according with the moves of the mouse, and at the same time the value on the texture's material will be adding or subtracting the same values as the buttons. Basically It will be making a clic hold and drag and then from its coordinates the objects could move.

Hope you guys can help me figuring out how to make it, or at least some other resources that I can learn how to do it from.

Keep with the great work !
29 May 2017 09:48
Have you looked at the code in the Cartoon Interior sample project in you SDK?
It can be found at \blend4web_pro\apps_dev\tutorials\cartoon_interior in you SDK directory.
I have made a number of useful apps that use this code as a starting point.
I did some commercial work using drone scanned imagery then made an app so the architects could move buildings around to see how they fit.
I am not sure, but it may be easier to move objects around rather than move materials. You can show, hide and move objects pretty easily. Even without programming, you could do that with logic nodes.

Also the Bone API in your Code Snippets has some mouse drag functions. Mouse drag in 3D is complicated because it all has to be relative to the camera's position.
29 May 2017 13:23
Thank you Will to spend some of your time to answer me, but I know already how to do it with some buttons to initiate the sliding like up and down but I can't don't understand much of javascript to do it only with the movement of the mouse like a real sliding bar.

Here it is my example cause I don't know if you got access to my file so if you want to check it to understand better my struggling :
30 May 2017 10:05
I am not sure what you want to do. Do you want your slider to be inside the 3D scene or more like a UI element? Would it be easier to do it with CSS and JavaScript in a div that overlays your 3D canvas?
Do you know of an example somewhere of your idea that is working? I am still not sure how you want things to slide and follow the mouse.
30 May 2017 12:58
It would be more like a UI element but I'm just trying to create things by modules . So I could create an UI inside blend4web that could be exported with only one webplayer file. But anyway, thank you for your time.
Please register or log in to leave a reply.