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. 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)
Thank you so much @LBPToo for your update in SKActorExplosion with Debris Delete after a delay will improve the game's performance.
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.
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.
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: USAGE:
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.
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.
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.
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.
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
Thanks for this. It's awesome! lol. Lucky I read the above too, otherwise I would have been scratching my head
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.
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.
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