hello first I don’t speak English, I use a translator.
my current project uses the view to the 3rd person but laterally - as on a game of ( platform ( Sonic )).
I would like to find a function that I can’t find. It would cause an object to fall from the sky and explode an object on the ground
I find the function of physics but the falling object does not destroy it and does not break the object on the ground.
I couldn’t find any tutorials on this if anyone was kind enough to explain to me thank you
Hello. Welcome to the Forum
I will try my best to keep the instructions simple.
As you mentioned, you have already found out how to do the falling object part. Now, assuming you are using the "Physics Sphere / Physics Cube", etc., this already has the Damageable properties and interface enabled and can already be destroyed without changing too much.
So you can add a Trigger to the falling object to detect when the object hits the ground using
trigger:beginOverlapEvent(). When it does, you can use
World.FindObjectsOverlappingSphere() (link here) to find which objects overlap the exploding object. You can then do a check to see if these overlapping objects are
Damageable and run
ApplyDamage(Damage) on them.
Here is an example of this working with Core's default Damageables and the Physics Sphere:
I am willing to share the project file if you would like, however, I would encourage you to at least attempt this yourself first. It will be more beneficial as you will gain more knowledge
To other devs reading this - this might not be the best or most efficient way of doing something like this, so if you have an alternative answer, please do share as I would also be interested in gaining more knowledge in this regard
First of all I want to say thank you for having answered me.
I actually try with the trigger but it didn’t give any result ( certainly I’m too bad in script ) to add the function damage or dies.
I will seek and persevere this will indeed be more rewarding, I just hope I do not tire of going around in circles. and achieve the desired result.
If you do not manage to figure it out please let me know and I will try to help you. Have a good week
thank you very much, I think it’s my hierarchies that must not be good because when I launch the game the ball is already landing on the ground instead of falling, so it does not explode
@mscalibur I have published the project file. You can find this in Create > Community Projects > Sort By: Newest > ExplosionTest. You can use that as an example. I hope this will help you.
With the ball falling, you will have to use some sort of trigger to spawn the ball, it should not be in the world when the game starts, or else it will fall at game start. So have a look at how I did it and make adjustments from there.
hoooooo ok, I didn’t think of that what an idiot
Don't feel bad, and don't get discouraged. I have been coding for over 15 years and still finding Core a bit difficult to understand at times. If you do need any other help, don't hesitate to ask. I am also available via DM if you prefer.