generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: ok i used raycasting

Previous Thread :: Next Thread 
llaserx is not online. llaserx
Joined: 10 Dec 2011
Total Posts: 53069
26 Jul 2016 08:08 PM
local scool = false
function shoot()
if equipped == true then
-- if scool then print 'cooling down' return end
--scool = true
print 'shot'
local ray = Ray.new(currpri[1].SmokePart.CFrame.p, (mouse.Hit.p - currpri[1].SmokePart.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)

local b = Instance.new("Part",game.Workspace)--Bullet
b.Size = Vector3.new(1.42, 0.4, 0.4)
b.Position = currpri[1].SmokePart.Position
b.CanCollide = false
b.CFrame = b.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(20),0,0)

local bv = Instance.new("BodyVelocity",b)
bv.Velocity = char.Torso.CFrame.lookVector * 100

local distance = (currpri[1].SmokePart.CFrame.p - position).magnitude
b.CFrame = CFrame.new(currpri[1].SmokePart.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)


-- b.Position = Vector3.new()


end
end

now the part spawns at the mouse position
what do


r+://290739801r+://290739819r+://290739831 R$1,248 (づ ゚ ³ ゚)づ
Report Abuse
llaserx is not online. llaserx
Joined: 10 Dec 2011
Total Posts: 53069
26 Jul 2016 08:31 PM
how to make part go from smokepart tomouse position!!!


r+://290739801r+://290739819r+://290739831 R$1,248 (づ ゚ ³ ゚)づ
Report Abuse
Dominical is not online. Dominical
Joined: 04 Nov 2011
Total Posts: 1303
26 Jul 2016 08:35 PM
Lol be more specific. No one here knows what you're talking about.


Report Abuse
peIicans is not online. peIicans
Joined: 02 Nov 2013
Total Posts: 1148
26 Jul 2016 08:40 PM
i do once sec


Report Abuse
peIicans is not online. peIicans
Joined: 02 Nov 2013
Total Posts: 1148
26 Jul 2016 08:42 PM
local ray = Ray.new(currpri[1].SmokePart.CFrame.p, (mouse.Hit.p - currpri[1].SmokePart.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
local distance = (currpri[1].SmokePart.CFrame.p - position).magnitude
local b = Instance.new("Part",game.Workspace)--Bullet
b.Anchored = true
b.Size = Vector3.new( 0.4, 0.4, distance)
b.Position = currpri[1].SmokePart.Position
b.CanCollide = false
b.CFrame = b.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(20),0,0)
game.Debris:AddItem(b, .1)



b.CFrame = CFrame.new(currpri[1].SmokePart.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)


Report Abuse
llaserx is not online. llaserx
Joined: 10 Dec 2011
Total Posts: 53069
27 Jul 2016 12:50 AM
i wish i saw this earlier

i im not trying to makea ray

im trying to manipulate the ray to shoot bullets towards the mouse


r+://290739801r+://290739819r+://290739831 R$1,294 (づ ゚ ³ ゚)づ
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
27 Jul 2016 12:53 AM
bullet.CFrame = CFrame.new(muzzle.Position,mouse.Hit.p)

while bullet do
wait()
local r = Ray.new(bullet.Position,bullet.lookVector*10)

local hit,pos = game.Workspace:FindPartOnRay(r)

if hit then

--DO STUFF
bullet:remove()

end
end
end
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
27 Jul 2016 12:53 AM
oh and also, forgot to add this

bullet.CFrame = bullet.CFrame + bullet.lookVector*10

after making the raycast
Report Abuse
llaserx is not online. llaserx
Joined: 10 Dec 2011
Total Posts: 53069
27 Jul 2016 12:58 AM
oh i got it now

i needed to change the the bullets CFrame

thanks daily

qq


r+://290739801r+://290739819r+://290739831 R$1,294 (づ ゚ ³ ゚)づ
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image