Sk Explosion Asset

Discussion in 'BBAssets' started by particles, Oct 30, 2018.

  1. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    336
    Likes Received:
    242
    Node Name: SKExplosionByParts
    Description: This Asset includes explosion with asset and camera shake node. Detail description mentioned below.
    • Which can be reused in other projects.
    • Sample SKActorExplosion.bbdoc .
    • SKExplosionByParts Script can be copied and used in other moving objects.

    [​IMG]


    SKExplosionByParts

    • Change the shape of debris (Make sure to enable physics with Dynamic type for your object shape)
    • Adjust the colour of debris
    • Adjust the size of debris
    • Adjust Linear and Angular velocity of the explosion.
    • Asset Names : body (Single Asset)
    • Asset Names : head, body, tail (Multiple Assets)
    [​IMG]
     

    Attached Files:

    Last edited: Dec 18, 2018
  2. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    336
    Likes Received:
    242
    Thank you so much @LBPToo for your update in SKActorExplosion with Debris Delete after a delay will improve the game's performance.
    [​IMG]
     

    Attached Files:

    itzonator, yenomeerf and LBPToo like this.
  3. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    139
    Yep, no problem. I originally did it for the visual effect, but then I too thought, where are all these little objects ending up.....eating memory of course(and calc/drawing cycles)....so the secondary benefit was a good one. Actually everyone that uses this node should set debris delete on and just set the time delay high if they don't want the debris disappearing to be obvious. Still looking forward to the ability to set the transparency so they can fade out.
     
    particles likes this.
  4. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    336
    Likes Received:
    242
    Yes. Later, I have implemented an delay node to remove debris in my project to make it available for garbage collection ( assuming that BB3 implemented that) and forgot to update in the explosion asset. Thanks for extending and handy for others to use it.
     
  5. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    336
    Likes Received:
    242
    Thankyou @LBPToo

    Based on @LBPToo unlimited array of assets for explosion code, We have updated existing SKExplosion to SKExplosionByParts. Now user can specify explosion debris by parts like Head, Body and Tail etc.

    Asset Names : body (Single Asset)
    Asset Names : head, body, tail (Multiple Assets)
    Make sure to enable Physics with Dynamics in your Assets

    PREVIEW:
    [​IMG]

    USAGE:
    [​IMG]
     

    Attached Files:

    Last edited: Nov 6, 2018
    ZackGriset and Phil H like this.
  6. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    139
    Thanks particles. I wanted to add one thing(or maybe two), make sure you actually have the objects in your object list that exactly match the names you put in the "Asset Names" attribute or it will crash. There is no error checking to catch this error. Also, each asset name you put in the list multiplies the amount you put in the "Total" attribute. So if you list 4 names in the Asset Name list, and 50 in the Total attribute, that means it would make 50 of each named object, or a total of 200 objects when it explodes. If you use a lot of objects like this, make sure you use the Delete Debris option.

    Here's an example of what you can do using this node. This has 10 pieces of debris and 5 of each. It can run faster, I just made it go slowly so it could be seen better.

     
    Last edited: Nov 6, 2018
  7. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    336
    Likes Received:
    242
    Yes. I haven’t added try catch for unavailable debris. Please add that message for user to know. @LGBtoo I know this. Total is actually each debris total. If 2 debris then multiply by two.

    I have added delta time for checking delay time increments. So that user can specify 1, 0.5 seconds like that.

    And I have added drirectly entity.remove() method to remove after the delay time to improve performance. Let me know any performance issues you facing, I will look over it.
     
    Last edited: Nov 6, 2018
  8. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    139
    Yep, I knew you knew that. It was for everyone else reading this thread. :)

    Thanks.
    Great. Really important. Everyone should update to this version and use delete if at all practical, especially if you're generating a lot of debris objects.
     
  9. ji eliassaa

    ji eliassaa Boxer

    Joined:
    Nov 7, 2018
    Messages:
    6
    Likes Received:
    1
    hello guys nice update !! how can I make the enemy explode instead of the character ?
    thank you
     
  10. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    139
    The exact same way as the character. Just put "if collide, defeat, and explosion" nodes in the object. The object needs to be a physics object to have a collision shape, but does not have to be dynamic.
     
  11. ji eliassaa

    ji eliassaa Boxer

    Joined:
    Nov 7, 2018
    Messages:
    6
    Likes Received:
    1
    Thank you so much !
     
  12. Jackps

    Jackps Boxer

    Joined:
    Mar 12, 2018
    Messages:
    26
    Likes Received:
    6
    Hi guys, why when i use this asset, my animation freeze in end

    [​IMG]
     
  13. Jackps

    Jackps Boxer

    Joined:
    Mar 12, 2018
    Messages:
    26
    Likes Received:
    6
    :eek: I forgot turn on physics for objekts, it is working now
    Thank so much for nice asset
     
    Last edited: Dec 17, 2018
    spicedbeangames likes this.
  14. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    139
    My guess is that you either don't have the correct names in the attribute Asset Names that match exactly the assets in your object list you're using for the debris, or you don't have a debris object in your list that matches a name you put in the Asset Names list
     
    Jackps likes this.
  15. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    139

    Yep, I should have remembered. I did that the first time I used it too.
     
    Jackps likes this.
  16. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,328
    Likes Received:
    557
    Thanks for this. It's awesome! lol. Lucky I read the above too, otherwise I would have been scratching my head
     
    Jackps likes this.
  17. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,328
    Likes Received:
    557
    Quick question - is there a way to prevent the debris from colliding with other objects? I've tried to remove the mesh, played around with other settings but when the explosion happens, the small debris bounces off other things like balls, knocking them off their path.
     
  18. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    139
    First, the debris has to by dynamic physics objects, there's no way around that. The two things I can think of is if the other objects don't have physics of any type turned on, and you might try making the other objects have mesh collision types. Dynamic mesh collision types will not collide with other types if physics objects that have mesh collision types. Those are the only two things I can think of right now.
     
  19. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,328
    Likes Received:
    557
    Yeah I've tried that. And the shapes are balls - spheres with physics on Dynamic. They used to be kinematic as I had this problem earlier, but then they couldnt roll on the level path.

    It could be a bug, or perhaps @NikRudenko can create a node that removes the collision shape or a 'decoration' node as in BB2
     
  20. Ahmad Naamneh

    Ahmad Naamneh Boxer

    Joined:
    Dec 24, 2018
    Messages:
    38
    Likes Received:
    4
    thanks for the great node, easy to use:) where can i find all your developed assets?
     

Share This Page