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
 

Raycast not functioning

Previous Thread :: Next Thread 
GreatOculus is not online. GreatOculus
Joined: 30 Aug 2009
Total Posts: 2103
09 Nov 2015 07:26 PM
Trying to create a ray between 2 points. Don't need to detect parts or anything like that. Just need to make the ray part and then remove it after half a second.

--fire is being passed a part or union

local function fire(target)
local function mkRay(origin, goal)
--local ray = Ray.new(origin, goal * 300)
local beam = Instance.new("Part", game.Workspace)
local distance = (origin-goal).magnitude
beam.Size = Vector3.new(0.3, 0.3, distance)
beam.CFrame = CFrame.new(origin, goal) * CFrame.new(0, 0, -distance / 2)
game.Debris:AddItem(beam, 0.5)
end
mkRay(model.Origin1.CFrame.p, target.CFrame.p)
mkRay(model.Origin2.CFrame.p, target.CFrame.p)
end



Much love -GO
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
09 Nov 2015 07:29 PM
you never called fire
Report Abuse
GreatOculus is not online. GreatOculus
Joined: 30 Aug 2009
Total Posts: 2103
09 Nov 2015 07:30 PM
I did, I just didn't post the whole thing.

Much love -GO
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
09 Nov 2015 07:31 PM
Oh, well can you be more clear. What's not working? Any errors? etc. because what you have seems fine. (although you might have to change the formfactor to custom)
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
09 Nov 2015 07:33 PM
goal isnt a unit vector

ray = Ray.new(start,direction*distance)
ray = Ray.new(start,(end-start)*distance)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
09 Nov 2015 07:34 PM
OP's not creating a ray, it's 'commented' out but if he does decide then yeah. (end - start) (without the * distance)
Report Abuse
GreatOculus is not online. GreatOculus
Joined: 30 Aug 2009
Total Posts: 2103
09 Nov 2015 07:38 PM
Yeah. Just trying to create a part between 2 points. I don't actually need the functionality of a ray.

The result of this is very weird.

It just kind of lagged the game out, similar to how an infinite loop does, although this is not inside an infinite loop so I'm not sure what happened.

Much love -GO
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