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: Raycasting sideways

Previous Thread :: Next Thread 
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 07:16 AM
So I have a raycasting script, and it works. The problem is that the ray stays verticle between the two parts, and stays in the middle. How can I turn it so that it "connects" to both ends of the parts?

Picture: https://twitter.com/AgentL3r/status/652819771298344961

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 07:17 AM
script.Parent.Touched:connect(function(hit)
if hit.Name == "start" then
local p1 = hit
local p2 = script.Parent

local ray = Ray.new(p2.CFrame.p)
local position = workspace:FindPartOnRay(ray, script.Parent, false, false)

local hose = Instance.new("Part", hit.Parent)
hose.Name = "ext"
hose.BrickColor = BrickColor.new("Bright yellow")
hose.CanCollide = false
hose.Material = "Plastic"
hose.Anchored = true
hose.FormFactor = "Custom"
hose.BackSurface = "Smooth"
hose.BottomSurface = "Smooth"
hose.FrontSurface = "Smooth"
hose.LeftSurface = "Smooth"
hose.RightSurface = "Smooth"
hose.TopSurface = "Smooth"
script.Mesh:Clone().Parent = hose

while true do
local dis = (p1.Position - p2.Position).magnitude
hose.Size = Vector3.new(0.4, dis, 0.4)
hose.CFrame = CFrame.new((p1.Position + p2.Position) / 2, p2.Position)
wait()
end
end
end)

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 08:14 AM
b

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 08:29 AM
b2

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 08:50 AM
b3

#code for i,v in pairs dont
Report Abuse
darkstriken is not online. darkstriken
Joined: 23 Oct 2010
Total Posts: 376
10 Oct 2015 08:51 AM
eww while loop
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 09:22 AM
b4

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 09:51 AM
b5

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 10:17 AM
b6

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 10:54 AM
b6

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 10:57 AM
b7

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 11:11 AM
b8

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 01:11 PM
b9

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 01:17 PM
b10

#code for i,v in pairs dont
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 01:37 PM
b11

#code for i,v in pairs dont
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
10 Oct 2015 01:38 PM
ray = Ray.new(start_position,end_position-start_position)



Instance.new("BodyVelocity",SenseiWarrior).velocity = CFrame.new(SenseiWarrior.Torso.Position,YourGirlsDMs.Position).lookVector * 10
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 01:48 PM
^ Finally, a reply!

I already added that in my script after I posted this, and unfortunately I have the same problem.
Rotation doesn't work.

#code for i,v in pairs dont
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
10 Oct 2015 01:48 PM
@dark Are you dumb? A while loop is not "ew". It is simply a part of Lua. After all, a numeric for loop would be the same.
Report Abuse
darkstriken is not online. darkstriken
Joined: 23 Oct 2010
Total Posts: 376
10 Oct 2015 01:50 PM
its unneccessary here, idiot
Report Abuse
darkstriken is not online. darkstriken
Joined: 23 Oct 2010
Total Posts: 376
10 Oct 2015 01:50 PM
also atay off my turf, your always bothering me
Report Abuse
AgentL3r is not online. AgentL3r
Joined: 14 Jan 2013
Total Posts: 1671
10 Oct 2015 01:52 PM
b12

#code for i,v in pairs dont
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
10 Oct 2015 01:59 PM
@dark actually, it is needed to constantly update it. Atleast when you call me an idiot, double check to make sure you wont make a fool of yourself.
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
10 Oct 2015 02:02 PM
p1 and p2 aren't changing and given that everything in the loop is based off of those two values, it's not necessary in any way. You should double check yourself to make sure your not an idiot before making an argument that your not.
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
10 Oct 2015 02:02 PM
But what if they eventually do change?


OHHH I GOT REKT
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
10 Oct 2015 02:05 PM
Given that the only reason that they will change is when the event is triggered, what's the point of looping in the event for when they change.

Also for the original problem, try switching the size along with Y-axis with the size along the Z-axis.
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