ios - Can't add several pod resources to the scene -


i try use cocos3d , need show several 3d objects placed on sphere in front of camera. so, here code:

@interface cocos3d_testscene : cc3scene {     cc3resourcenode* reznode;     cc3resourcenode* resnode; }  - (void) onopen { ...     reznode = [cc3podresourcenode nodefromfile: @"arrow.pod"];     reznode.scale = cc3vectormake(0.03, 0.03, 0.03);     reznode.rotation = cc3vectormake(90, 90, 0);     [self addchild: reznode];     reznode.location = cc3vectormake(0, 0, -1.9);      resnode = [cc3podresourcenode nodefromfile: @"arrow.pod"];     resnode.scale = cc3vectormake(0.03, 0.03, 0.03);     resnode.rotation = cc3vectormake(90, 0, 0);     [self addchild:resnode];     resnode.location = cc3vectormake(0, 0, -1.9); ... } 

so can't see second arrow on scene. how can solve this?

in cocos3d, resources cached. loading same pod resource twice, doing, result in both cc3podresourcenode attempting use same content. since node can have single parent, second loading has effect of moving descendants of first cc3podresourcenode instance second instance, leaving first cc3podresourcenode instance no descendants.

instead of attempting load multiple copies of same resource file, copy nodes want duplicate. copying node performs deep copy, copying descendant nodes well. preserve memory, mesh vertex content, static , can quite large, not copied, , 2 or more nodes can share same mesh content.

for example, following should want:

    resnode = [reznode copy];     resnode.rotation = cc3vectormake(90, 0, 0);     [self addchild: resnode]; 

since scale , location properties of both nodes same, copy take care of setting them in second instance.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -