We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

object join selection/group in puzzles?

Home Forums Puzzles object join selection/group in puzzles?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #20482
    GLiFTeK
    Customer

    hio
    is it able to have a lone object become part of a collection using puzzles?
    possibly javascript?

    is using group the same as collections?
    ie:

    //These cubes can now be rotated / scaled etc as a group
    var group = new THREE.Group();
    group.add( cubeA );
    group.add( cubeB );
    
    scene.add( group );
    #20490

    Hi,

    to add an object to a collection, you can use the following code:

    myObj.groupNames.push('mycollectionName');

    Chief 3D Verger | LinkedIn | Twitter

    #20516
    GLiFTeK
    Customer

    Hi,
    to add an object to a collection, you can use the following code:
    myObj.groupNames.push('mycollectionName');

    to discern the object and the group in puzzles i did this.. but not working.. any pointers?

    app.ExternalInterface.addToGroup = function(myObj, mycollectionName) {       
               myObj.groupNames.push(mycollectionName);
        }

    then also

    app.ExternalInterface.addToGroup = function(myObj, mycollectionName) {       
         var object = myObj.groupNames.push(mycollectionName);
        }

    no dice

    #20517

    myObj there is actual object rather than name so you need to get it first:

    var myObj = app.scene.getObjectByName('myObjectName');
    myObj.groupNames.push('mycollectionName');

    Chief 3D Verger | LinkedIn | Twitter

    #20520
    GLiFTeK
    Customer

    2

    var myObj = app.scene.getObjectByName(‘myObjectName’);
    myObj.groupNames.push(‘mycollectionName’);

    kk.. soo liiiiike..
    to wrap that in a JS call puzzle.. so i can use it in puzzles… and to designate those….
    i use app.ExternalInterface.addToGroup = function ()
    before that right?
    then designate the inputs the JScall puzzle piece has as inputs as function parameters right?

    trying like this..

    app.ExternalInterface.addToGroup = function () {
                var myObj = app.scene.getObjectByName('Info_Glass');
                myObj.groupNames.push('Fader Collection');
                }

    does the job perfect.

    but i want to make the puzzle have inputs so i can plug in any items as the object and the array, IN the JS Puzzle…. like this..

    app.ExternalInterface.addToGroup = function (objectToAdd,arrayToAddTo) {
            var myObj = app.scene.getObjectByName(objectToAdd);
            myObj.groupNames.push(arrayToAddTo);
            }  

    but not working. the JS call inputs should be named the function parameters right?

    edit… this attempt here..

    app.ExternalInterface.addToGroup = function (objectToAdd) {
            var myObj = app.scene.getObjectByName(objectToAdd);
            myObj.groupNames.push('Fader Collection');
            }

    works where i can plug in any object to the object to be added slot…

    i think the last above version is satisfactory for what i’m doing.
    if i need a different collection to add to, i’d just make a new js call with the different collection designated.

    but i’m curious.
    is the “groupNames” distinct to v3d.js ?
    if so, i’m guessing it’s what designates collections?
    that in mind, i’m wondering how to format the above to receive a variable that would allow for dynamic naming of whichever list i want.

    do you use .filter() to REMOVE objects from collections?

    #20587

    is the “groupNames” distinct to v3d.js ?
    if so, i’m guessing it’s what designates collections?

    yes and yes!

    that in mind, i’m wondering how to format the above to receive a variable that would allow for dynamic naming of whichever list i want.

    I think this variant of yours should work

    app.ExternalInterface.addToGroup = function (objectToAdd,arrayToAddTo) {
            var myObj = app.scene.getObjectByName(objectToAdd);
            myObj.groupNames.push(arrayToAddTo);
            }  

    do you use .filter() to REMOVE objects from collections?

    yes this should work!

    Chief 3D Verger | LinkedIn | Twitter

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.