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 » Scripting Helpers
Home Search
 

Re: raycast problem

Previous Thread :: Next Thread 
4567777 is not online. 4567777
Joined: 13 Jul 2013
Total Posts: 128
17 Nov 2013 10:48 PM
I am ray-casting from the players torso downwards, so I can detect whether the player is touching the ground and what material he is touching.

the problem is that if I move far enough from the middle of the baseplate, the ray doesn't detect anything even though I'm still on top of the baseplate.

here is my script:


local ray = Ray.new(torso.CFrame.p,torso.CFrame.p - Vector3.new(0,8,0))
local ignore = {game.Workspace.part1, game.Workspace.part2}
local hit, position = Workspace:FindPartOnRayWithIgnoreList(ray, ignore)
if(hit~=nil)then
print('touching ground on: '..hit.Name)
touchingGround = true
local surface = hit:FindFirstChild('surfaceType',true)
if(surface~=nil)then
print(hit.surfaceType.Value)
surfaceType = hit.surfaceType.Value
end
end
if(hit==nil)then
print('not touching ground')
touchingGround = false
end


yes I defined surfaceType,touchingGround and torso
Report Abuse
4567777 is not online. 4567777
Joined: 13 Jul 2013
Total Posts: 128
17 Nov 2013 11:25 PM
bump
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
17 Nov 2013 11:43 PM
[ Content Deleted ]
Report Abuse
FrozenSmite is not online. FrozenSmite
Joined: 17 Jul 2013
Total Posts: 2242
17 Nov 2013 11:49 PM
Umg its oysi! :O

♫♪ repeat wait() until game.Players.FrozenSmite.HasALife == true ♪♫
Report Abuse
4567777 is not online. 4567777
Joined: 13 Jul 2013
Total Posts: 128
18 Nov 2013 12:35 AM
thank you so much, it works now! :)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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