|
| 11 Mar 2017 07:45 PM |
Since this event only works when the explosion is actually in workspace, is there a way to get any parts that are within a given radius like an explosion does?
I want the reaction time to parallel that of a basic explosion which is why I don't want to loop through workspace to find a part within the radius
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 Mar 2017 07:46 PM |
Why not just parent it to workspace?
-- Former AKA : luis15232 |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2017 07:51 PM |
Because explosions create lag and are generally annoying to deal with imo
Can't change the color or do anything with them, but they have a neat hit detection event that I'd like to replicate
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 Mar 2017 07:53 PM |
I'd do something like this There might be a more efficient way:
the script algorithm in steps
1. Create a round part with a CFrame of the center of the explosion position with a radius of the blast radius of the explosion 2. add a touched event for the part 3. part.touched -- do stuff 4. delete part after half a second or something
-- Former AKA : luis15232 |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2017 07:55 PM |
Isn't there a delay in the touched event or something
Also if I position a part in a location isn't it not going to register as touched since it didn't technically come into contact?
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 Mar 2017 08:00 PM |
oh right do
Part:GetTouchingParts()
it returns an array of all the parts touching
-- Former AKA : luis15232 |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2017 08:14 PM |
I tried that, it's relatively unreliable
I'm literally standing on a part and calling it and it's only returning stuff if they're INSIDE of it rather than if they're coming into contact with it
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 Mar 2017 08:20 PM |
http://wiki.roblox.com/index.php?title=API:Class/BasePart/GetTouchingParts
Maybe that might help
or
https:// scriptinghelpers .org /questions/18857/how-could-you-check-if-theres-a-brick-right-next-to-a-part-or-not
-- Former AKA : luis15232 |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2017 08:28 PM |
See it wouldn't be a problem if that function would return parts that are touching regardless of their CanCollide...
...but it doesn't so idk
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 Mar 2017 08:29 PM |
I don't know any other way than looping through workspace
Which would be very inefficient.
-- Former AKA : luis15232 |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2017 09:20 PM |
After a while I managed to make it work, thanks
|
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 Mar 2017 09:20 PM |
Nice!
-- Former AKA : luis15232 |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2017 09:27 PM |
Please don't use that. Use magnitude:
for i,v in pairs(game.Workspace:GetChildren()) do if v:IsA("BasePart") and (v.Position - Explosion.Position).magnitude <= Explosion.BlastRadius then --Your part is touching the explosion. end end |
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 Mar 2017 09:27 PM |
@Intended
Yes we said that he doesn't want to do that because if there are hundreds of parts it will lag.
-- Former AKA : luis15232 |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2017 09:29 PM |
| GetTouchingparts() will be a million times worse. Then you're going to have to generate a table for each individual part... Ew. |
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 Mar 2017 09:33 PM |
What?
Tables don't get generated for each individual part
It's just a table of all the parts touching.
How is that worse?
-- Former AKA : luis15232 |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2017 09:35 PM |
Ugh nevermind, I thought you were also suggesting to loop through everything. Sorry. End me. |
|
|
| Report Abuse |
|
|