|
| 29 Aug 2015 06:06 PM |
Hello, I have been in the process of making a game and have, sadly, reached an impasse. One of the weapons in my game is a flash light that can deal damage to any player that touches that light it emits (not a part). I have tried creating an invisible part however do not know how to get the size exactly right. Any contribution would be of great help, Many Thanks, Dstructiod |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 06:09 PM |
| Just size it to the light. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 06:19 PM |
| The light moves and there is no size property for spot lights due to this and the fact that the light can also hit walls which changes its shape means that this is not possible. The invisible part method seems an impossible one. I would have to make the spot light itself do damage. |
|
|
| Report Abuse |
|
|
tyzone
|
  |
| Joined: 16 Aug 2008 |
| Total Posts: 1726 |
|
|
| 29 Aug 2015 06:21 PM |
You could try to do a bunch of raycasting inside the light cone. Since it's a spot light, you know the angle of the cone, so you only have to put a few rays within that cone. Since your light has a limited range, you don't need to put thousands of rays, as a few dozens will be enough to notice any player within the cone AND within range.
eww no pink shaggy |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 06:22 PM |
| Oh ok I see the problem. Idk how to do that. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 06:26 PM |
Tyzone, Raycasting is an unfamiliar term to me. This seems really helpful however if you could expand I would be grateful. Many Thanks, Dstructiod |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 29 Aug 2015 06:26 PM |
| http://wiki.roblox.com/index.php?title=Raycast |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 29 Aug 2015 06:27 PM |
and this would probably help you too:
http://wiki.roblox.com/index.php?title=How_to_Make_a_Raycasting_Lasergun |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 06:33 PM |
| Reading those links now. Thanks a lot guys :) |
|
|
| Report Abuse |
|
|
KoreanBBQ
|
  |
| Joined: 06 Mar 2015 |
| Total Posts: 1436 |
|
|
| 29 Aug 2015 06:40 PM |
Why would you use raycasting, just use circle properties... where the source of the light is the center of the cercle, and the range would be the radius, and you can calculate whether or not a player is in the light
~TreeBranch, Owner of Lady of the Federation x2+ Crown of Roses |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 07:53 PM |
KoreanBBQ, Surely this would just create a big circle over the flash light itself rather than where the light actually is? If there is a way to put a circle over the spotlight itself it seems a lot easier and better for the game. Could you please explain exactly how this would work in more detail? Many Thanks, Dstructiod |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 29 Aug 2015 07:56 PM |
Why not just be basic people and use the sphere part and a .Touched event on said sphere part.
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 29 Aug 2015 07:58 PM |
Use raycasting
@Koreon The circle could extend through a wall, so people behind a wall could get tagged
@lita same thing |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 29 Aug 2015 07:59 PM |
Why are people on here so quick to suggest raycasting for everything? Raycasting is NOT the answer for everything. For something like this you could very well use my sphere method or work with magnitude, which would be much better than using raycasting.
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 08:00 PM |
Although easy I feel a sphere on the end of a stick would make the game aesthetically unpleasant and therefore the game play would be of much poorer quality. Many Thanks, Dstructiod |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 29 Aug 2015 08:01 PM |
Are you that dumb?
Seriously. Are you?
Use transparency, kid. The sphere would just be for hit detection, not visual.
good god none of you have common sense on these forums
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 29 Aug 2015 08:02 PM |
| No one said it was the answer for everything. Your sphere could be touched through a wall. And magnitude alone won't be enough detect walls |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 08:07 PM |
The sphere idea is a definite no as the game mechanics run through being able to use the torch for both light and damage. Once you "find" another player in the dark using the torch so long as they remain in that light they continue to take damage. Therefore a sphere on a stick would not work for the game in the slightest. Thanks for the input though and any other ideas would be much appreciated so long as they are within reason and the game mechanics. Many Thanks, Dstructiod |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 29 Aug 2015 09:28 PM |
A sphere would do exactly that, you clearly have no idea what you're talking about.
Using a loop while the sphere is touching another player, it can damage them over time and stop when they are no longer touching said sphere.
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2015 09:38 PM |
| Actually, you might be able to have a series of spheres that detect contact, but then use raycasting to figure out which ones are going through walls and disable them. |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 29 Aug 2015 09:40 PM |
Heres what I'd do.
I'd have the sphere, and if it hit I'd have it send a ray from the players torso to the torso of the player that was hit. If the ray hits a part between player and torso, then it doesn't deal damage. Otherwise, it runs the loop until the magnitude between the player and the other player exceeds the radius of said circle.
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 29 Aug 2015 09:46 PM |
An alternate version would be having a list of all players and their current positions, and if one of those was a set magnitude from player or less, it does a raycast to test if there is a wall and if not it does the loop.
However, this would involve having a loop or .Changed event for each weapon, which is inefficient. Therefore, my sphere+raycast method would be far more effective.
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|