How To Destroy Child Object?

Discussion in 'Buildbox General Discussion' started by Brandon Humfleet, May 25, 2019.

  1. Brandon Humfleet

    Brandon Humfleet Boxer

    Joined:
    Aug 14, 2018
    Messages:
    66
    Likes Received:
    20
    how would you destroy a child object, once the parent is destroy? i have been playing around with resizing the collision boxes, but i am getting weird bugs. any help would be great!!
     
  2. weboha

    weboha Avid Boxer

    Joined:
    Aug 8, 2018
    Messages:
    237
    Likes Received:
    174
    if your object moving or scaling you have select kinematic.
    static and dynamic works different
     
  3. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,334
    Likes Received:
    558
    I haven't a clue. But have you tried using the remove/defeat nodes on the child objects and adding 'if collide' with whatever it is that will destroy it?
     
  4. Brandon Humfleet

    Brandon Humfleet Boxer

    Joined:
    Aug 14, 2018
    Messages:
    66
    Likes Received:
    20
    @spicedbeangames yeah i am doing that currently, but my problem is when the parent gets destroyed the child doesn't get destroy as well, so it is left still active when the parent is destroyed. what i am doing is i have a ship that has 2 spawn points for the lazers, and when the ship is destroyed the lazers still spawn, i have tried resizing the lazers collision boxes so they would get hit has well when the parent gets hit but sometimes i can hit the collision boxes of the lazers an not the parent and then my lazers get destroyed and then it stops spawning. i just feel this is a very hackish way of doing this. i am open to any idea's. thanks.
     
  5. Killjoy1432

    Killjoy1432 Boxer

    Joined:
    Feb 2, 2019
    Messages:
    33
    Likes Received:
    6
    Well if you are using bb3 you can use the send and receive nodes for that put a send node attach it to the if collide on the actor then in the child asset node menu put in a receive node and attach a defeat node to that also you must name the send and receive nodes the same thing like destroy child for instance
     
    Last edited: May 26, 2019
  6. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,334
    Likes Received:
    558
    Buildbox has been built upon the community 'hacks'. But right now it feels if you want to do something - that in your mind should be pretty straight forward, like a jump and move, you'll find that there's problems and you spend the next 3-5 hours trying to work out where you went wrong, searching for answers and get very few.
     
  7. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    285
    Likes Received:
    191
    A couple of suggestions here.

    Put the ship and lasers in the same asset.

    Send a destroy event and listen for it in the lasers and if you get the event destroy the lasers too
     
  8. Brandon Humfleet

    Brandon Humfleet Boxer

    Joined:
    Aug 14, 2018
    Messages:
    66
    Likes Received:
    20
    @Killjoy1432 Thanks, i will try this and let you know if i run into any problems

    @PunkPuffin What do you mean by "Put the ship and lasers in the same asset" do you mean link them like parent child?
     
  9. Brandon Humfleet

    Brandon Humfleet Boxer

    Joined:
    Aug 14, 2018
    Messages:
    66
    Likes Received:
    20
    PunkPuffin likes this.
  10. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    285
    Likes Received:
    191
    @Brandon Humfleet I’ve also used the same method @Killjoy1432 and it works fine

    My other suggestion is to put multiple models in the ship asset then you don’t need to worry about children
     
  11. Killjoy1432

    Killjoy1432 Boxer

    Joined:
    Feb 2, 2019
    Messages:
    33
    Likes Received:
    6

Share This Page