How To Activate Connection Between Two Objects ?

Discussion in 'Buildbox 3.0' started by Kanishk Sachdeva, Oct 7, 2018.

  1. Kanishk Sachdeva

    Kanishk Sachdeva Avid Boxer

    Joined:
    Jul 10, 2018
    Messages:
    217
    Likes Received:
    16
    How can i connect two objects like it was an option in Buildbox 2 and let movement of one object influence the movement of another object ?
     
  2. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    If you're talking doing this in the scene editor, just drag one object in your scene object list on top of the object you want to be the parent. It will add it in a hierarchy under the parent object. They will move together the same as the parent.

    You can also do this programmatically in a node by adding one of the objects as a child of the other.

    let ents = this.scene().find('objectToAddasChild');
    ents will be an array of all the objects named objectToAddasChild. Unless you have multiple objects named the same the first element of the array will hold the object/entity you want to make the child.
    Now add the child object to the parent and it will again follow whatever the parent does.

    this.entity().addChild(ents[0]);
    If the object/entity you added was already a child of another object, it will be removed from that object.

    Bill
     
    Kanishk Sachdeva likes this.
  3. Kanishk Sachdeva

    Kanishk Sachdeva Avid Boxer

    Joined:
    Jul 10, 2018
    Messages:
    217
    Likes Received:
    16
    Thanks a lot , I will try it out later today. One more question regarding this , if I have a scale object / float object as a parent object would the child object follow that as well if the parent scales or floats ?
     
  4. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    I'd have to test it to be sure but I think whatever you do to the parent, the children will do the same. If you did an operation on a child, like rotate, it will only operate on that child.
     
    Kanishk Sachdeva likes this.
  5. onetap

    onetap Avid Boxer

    Joined:
    Oct 14, 2015
    Messages:
    122
    Likes Received:
    34
    Do you have an example BBDOC for this ?
     
  6. Josh (Nology Games)

    Josh (Nology Games) Avid Boxer

    Joined:
    Nov 27, 2017
    Messages:
    200
    Likes Received:
    155
    You can use the send/receive nodes. this will one object to move and tell another object move at the same time.
     
    Hue Buildbox likes this.

Share This Page