playMaker

Author Topic: How to use AddexplosionForce[SLOVED]  (Read 1530 times)

playmakertester

  • Full Member
  • ***
  • Posts: 211
How to use AddexplosionForce[SLOVED]
« on: November 06, 2020, 10:42:24 PM »
Hello.
I'm making a bomb.
What should I set the Game Object in AddexplosionForce?

There are five or more moving objects in the vicinity of the bomb, and if you are within a certain distance of the explosive, you want to wipe them out when it detonates.
« Last Edit: November 09, 2020, 07:59:03 PM by playmakertester »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: How to use AddexplosionForce
« Reply #1 on: November 07, 2020, 06:38:35 AM »
Hi.
The AddexplosionForce will only 'push away' object from the used location.

You can use a 'Overlap Sphere' to detect if enemies are in range.
The enemies that are in range will be placed in an array.

Then you can loop thru the array to check for example :
How close it is from the explosion (get distance)
If there is a wall between (do a raycast between the 2 and check for wall)

depending on the results you could give a certain damage, destroy or don't give any damage (behind wall)

also the force you could do manually for each instead of using 'AddexplosionForce'
as it might not detect if there is a wall or something.

playmakertester

  • Full Member
  • ***
  • Posts: 211
Re: How to use AddexplosionForce
« Reply #2 on: November 07, 2020, 03:02:53 PM »
Oh, I see, I can picture it.

I'll give it a try.
By the way, if there are two objects to be blown up, one at the front and one at the back, with a certain explosion object at the center, will they be blown up in the front and back directions if I follow this description?

AddexplosionForce doesn't specify the direction of the AddForce, so I was curious if those would work well.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: How to use AddexplosionForce
« Reply #3 on: November 09, 2020, 09:49:56 AM »
Hi.
if AddexplosionForce works fine for your case its fine to use that.

AddexplosionForce will do a similar thing (get center position from explosion, then get direction and distance to determent the force to do)

playmakertester

  • Full Member
  • ***
  • Posts: 211
Re: How to use AddexplosionForce[SLOVED]
« Reply #4 on: November 09, 2020, 07:59:44 PM »
Thanks djaydino!