seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 24 May 2013 06:25 PM |
| How would you go about making a raycast explosion? Like making a bunch of rays hit Characters within a certain radius during an explosion. |
|
|
| Report Abuse |
|
|
|
| 24 May 2013 06:31 PM |
| Why not just use a normal explosion... |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 24 May 2013 06:35 PM |
| Well, because it sucks when you have vehicles that you don't want to break apart just because an explosion happens. It causing massive lag depending on the vehicle, and kills people inside of a armored vehicle. Its more realistic to make a new explosion that makes a ray to all characters within a certain radius. Thus not killing those in an explosion while in an unanchored vehicle. Protecting them from harm. |
|
|
| Report Abuse |
|
|
|
| 24 May 2013 06:40 PM |
| Use magnitude to find characters in the radius of your explosion. Then draw rays between the center of the blast and the character's torso to make sure there isn't a wall in the way. |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 24 May 2013 06:45 PM |
| I know how to do it in a way, but I'm not sure how I'd do it for multiple people at the same time.. |
|
|
| Report Abuse |
|
|
|
| 24 May 2013 06:45 PM |
| Use a for loop to cycle through all the players. |
|
|
| Report Abuse |
|
|
|
| 24 May 2013 06:47 PM |
Also, for exploding vehicles... You can make the blast pressure 0 and still be able to check if the player was hit by the explosion, hurting players but not the environment. |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 24 May 2013 06:47 PM |
| I don't think that'd be fast enough to hit all at the same time. |
|
|
| Report Abuse |
|
|
|
| 24 May 2013 07:15 PM |
You dont need raycasting for this. For your surprise, I have already created this!
function recursionPartList(obj) local oL = {} for i,v in pairs(obj:children()) do if (v:IsA'Part' or v:IsA'WedgePart' or v:IsA'Seat' or v:IsA'VehicleSeat' or v:IsA'CornerWedgePart') then oL[i] = v else recursionPartList(v) end end return oL end
function phys_explosion(Pos,Rad,Pres,Par) local objectList = recursionPartList(Par) for i,v in pairs(objectList) do if (not v.Anchored) and (v.Position-Pos).magnitude < Rad then v:BreakJoints() v.Anchored = true v.Velocity = (v.Position - Pos).unit * (Pres / (v.Position - Pos).magnitude) v.Anchored = false print(v.Velocity) end end end
phys_explosion(Vector3.new(0,0,0),32,1000,workspace) |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 24 May 2013 07:51 PM |
| Like the guy above said, make the blast pressure 0 and use Explosion.Hit |
|
|
| Report Abuse |
|
|
| |
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 24 May 2013 11:54 PM |
Stealth, how exactly would you use that script..its confusing it looks nothing like an explosion script haha. And I looked into the Explosion.Hit event, it has a script for it already but doesn't factor in parts between the character and the explosion position |
|
|
| Report Abuse |
|
|
|
| 24 May 2013 11:56 PM |
@Sean
You don't know what an "explosion script" looks like because there is no such thing.
|
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 24 May 2013 11:56 PM |
| Okay it does, My bad. xD Still confusing though :P |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 24 May 2013 11:58 PM |
| By explosion script, I meant a script that goes into a projectile that creates an Explosion when it hits something. |
|
|
| Report Abuse |
|
|
|
| 25 May 2013 06:40 AM |
I gave the framework. The bottom of my script tells you how to use it.
I would suggest learning about functions. |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 25 May 2013 02:13 PM |
| I know that, but theres absolutely no instruction for it. From what I can tell anyways. |
|
|
| Report Abuse |
|
|
|
| 25 May 2013 05:00 PM |
phys_explosion(Vector3(0,0,0),32,1000,workspace)
phys_explosion(position,radius,pressure,location)
is this enough documentation? |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 26 May 2013 01:02 AM |
| I wasn't referring to that part. I know what that is. I meant everything above it. Like what exactly does it do? |
|
|
| Report Abuse |
|
|
|
| 26 May 2013 03:09 AM |
hmm If I wasn't on my phone atm I would take the script and post it into a working model... D:
Have to do that tomorrow :/ |
|
|
| Report Abuse |
|
|
|
| 26 May 2013 10:43 AM |
| Its an explosion, without the effect, and it doesnt break joints |
|
|
| Report Abuse |
|
|