Forum

Selectable object follows path

06 June 2016 16:10

Hi,

I am a newbie and from this tutorial : https://www.blend4web.com/en/article/23/
I try to have a selectrable object (cube) follows bezier curve.

With ctrl P : I have attached cube to curve and in Obect->Animation->Bake Action

But when I run the app, the cube selection doesn't work.

The other objects with simple keyframe (I) works well.

Any idea ?
06 June 2016 16:55

Any idea ?
Can you attache a file with the example?
Blend4web and that kind of thing.
06 June 2016 17:24
This is the files.

Thank you
06 June 2016 17:37

But when I run the app, the cube selection doesn't work.
We checked your scene and the cube that move along the curve is selectable after export to the engine. What do you mean then you say it isn't selectable and what you want to achieve?
Blend4web and that kind of thing.
06 June 2016 18:08

I want the cube to move along the curve when I select it
Maybe I am doing wrong :

I think I don't know what does it mean "export to engine"…
In apps_dev, I make python3 project.py -p myproject compile

And I use .html in deploy/apps

Isn't it enough to "export to the engine" ?


06 June 2016 18:25

I think I don't know what does it mean "export to engine"…
In apps_dev, I make python3 project.py -p myproject compile

And I use .html in deploy/apps

Isn't it enough to "export to the engine" ?
Hello!

"compile" command doesn't export the scene. It is for engine compiling/updating (depends on the type of the project).
To export your blender scene you need to use:
python3 project.py -p myproject reexport

Besides you can check in the browser console if your cube is really selectable:
var obj = b4w.scenes.get_object_by_name("obj_name");
obj.render.selectable
Blend4Web Team - developer
Twitter
LinkedIn
06 June 2016 18:42

My cube is selectable, but it doesn't move along the curve when I select it……

«function main_canvas_click(e) {
if (e.preventDefault)
e.preventDefault();

var x = e.clientX;
var y = e.clientY;

var obj = m_scenes.pick_object(x, y);

if (obj) {
if (_previous_selected_obj) {
m_anim.stop(_previous_selected_obj);
m_anim.set_frame(_previous_selected_obj, 0);
}
_previous_selected_obj = obj;

m_anim.apply_def(obj);
m_anim.play(obj);
}
}
»

The above code works on objects with "baked action" option ?
06 June 2016 18:57
Could you please attach exported project archive (https://www.blend4web.com/doc/en/project_manager.html#project-export)
So I can easily check your issue
Blend4Web Team - developer
Twitter
LinkedIn
06 June 2016 21:46
Actually I can't use project manager because I get an error with "create new project" :
"Traceback (most recent call last):
File "/media/prince/a94a0881-d13f-49b3-ab1b-5ff15a8e571e/CreationInteractive/Blender/blend4web_sdk_free/apps_dev/project.py", line 43, in
import project_cli
File "/media/prince/a94a0881-d13f-49b3-ab1b-5ff15a8e571e/CreationInteractive/Blender/blend4web_sdk_free/scripts/lib/project_cli.py", line 327
print(" " + "-"*(len(err)), file=sys.stderr)
^
SyntaxError: invalid syntax
"
I use Ubuntu.
Hard luck !!! :)
07 June 2016 10:11
Hello.

Your objects are ok. But your actions aren't. I have baked the curve action and reexported the scene and it did the trick.



And I removed the "carre" cube parent.

Take a look at the attached files.
 
Please register or log in to leave a reply.