Forum

Basic example of copying object in javascript

09 February 2016 17:08
Hi

I'm trying to copy object in a scene, but can't make it work…..
I've got an object , and do….

m_objets.copy(obj,'newNameObject2');
var obj2= m_scenes.get_object_by_name("newNameObject2");
moveYObject(obj2,0.5); // custom function to move object in Y axis
m_scenes.show_object(obj2);

Any idea????

09 February 2016 17:16
I think you need to use append_object function to returned value by copy.
Blend4Web Team
kirill@blend4web.com
09 February 2016 17:18
var obj2=m_objets.copy(obj,'newNameObject2');
m_scenes.append_object(obj2);
moveYObject(obj2,0.5); // custom function to move object in Y axis
// ......
09 February 2016 17:27
you save my day. thanks.
09 February 2016 17:33
You are welcome.

you save my day. thanks.

I highly recommend to read documentation
Blend4Web Team
kirill@blend4web.com
09 February 2016 18:03
i don't know why but i was looking in API doc. Your link's perfect
Thanks
 
Please register or log in to leave a reply.