|
| 06 Feb 2016 09:55 PM |
So this is the wikis way of using raycasting. What this script does is it creates a "ray" and it is quickly created from the position of the tools handle to where my mouse clicked. What I'm TRYING to do is to make a ray that is created at the handle of my tools position and shoots out a BULLET like part that moves slower than the ray. How would I make this? I hope this explanation made sence. Please Help!?
wikis script...
local tool = script.Parent local player = game:GetService("Players").LocalPlayer tool.Equipped:connect(function(mouse) print("Tool equipped!") mouse.Button1Down:connect(function() print("Mouse pressed!") local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300) local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("Bright red") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = 0.25 beam.Anchored = true beam.Locked = true beam.CanCollide = false local distance = (tool.Handle.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) game:GetService("Debris"):AddItem(beam, 0.1) end) end) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 06 Feb 2016 10:29 PM |
A bullet that moves >slower< than the ray itself? I think you made a typo there.
You want the raycast to be like a tracer to a bullet right? That's... a loooooot of algorithm. Like.. I'm too tired to do about an hours with of algebra right now. Sorry Q Q |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 06 Feb 2016 10:32 PM |
@konich
OOH. thanks dude! really cleared things up for me! |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:32 PM |
@konich
thanks for the helpful reply, we all appreciate it |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Feb 2016 10:32 PM |
wow cool konichaw
i will work on the algorithm now |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:33 PM |
lmao... you boys... look familiar. OH WAIT. *checks skype*
|
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:35 PM |
| I don't even have you on Skype. |
|
|
| Report Abuse |
|
|
| |
|
Kizal0
|
  |
| Joined: 22 Sep 2015 |
| Total Posts: 376 |
|
|
| 06 Feb 2016 10:36 PM |
Lol david.
#code Some people call me savage. -Kizalo- |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:37 PM |
GET ON SKYPE MY OLD CODER BUDDIES!!1
|
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:37 PM |
Gubbins is online right now on skype, so get on and we can all re-unite after 3 years.
|
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:38 PM |
"GET ON SKYPE MY OLD CODER BUDDIES!!1"
wat |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 06 Feb 2016 10:39 PM |
| foreverdev is garbage tbh fam |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:40 PM |
yea foreverdev cant script like wtf he always ask stupid c question and i know java is better what a scrub
|
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:42 PM |
| Okay so I'm having a problem. I'm trying to make a gun. When I add a touched event that kills the player when the bullet hits the player, it rarely works. Someone told me to use raycasting for this instead so can someone please help out? ;( |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:46 PM |
| b is there any other way besides making an "algorithm that would take an hour to make". |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 10:47 PM |
| hmmm you can hack the matrix |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Feb 2016 10:55 PM |
Ok, so the way this gun shoots is what I'm trying to do...
http://www.roblox.com/Red-Hyperlaser-Gun-item?id=212296936 |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 06 Feb 2016 11:23 PM |
| Some pretty painful math. Lookup "Roblox University" on YouTube. Net Gun parts 1 thru 3 stickmasterluke explains raycasting. Sort of... |
|
|
| Report Abuse |
|
|