I think the main issue is with terrain, but if it doesn’t work with normal parts than I think its something wrong with their script.
hey, sure, well, nothing much, it prints the part as its meant to, and when you go to terrain, pip, it prints material’s plastic
bruh
Maybe try that. Maybe tell someone who has access to #platform-feedback:studio-bugs to post something about this there. Staff like to check out the Studio Bugs area quite a bit.
I’m pretty sure this isn’t supposed to happen, I guess it’s a bug and you can’t do anything to fix it
Hi, I hope what I say helps. I found a similar thread where someone was trying to print out the material but it also returned as plastic
https://devforum.roblox.com/t/detecting-the-material-of-terrain-with-a-touched-function/299830/3
In this post, a Roblox staff member suggested checking out Humanoid.FlootMaterial in the API reference. Heres the link to that: https://developer.roblox.com/en-us/api-reference/property/Humanoid/FloorMaterial
Hey, I have to check what’s under a part… so that will be hard
Anyone knows any solution to this D:
Try to visualize your rays by materializing them into short lifetime parts.
Or create a non-collision part to show the ray’s end position
(to debug)
I don’t think I should try that… since, Instance == workspace.Terrain returns true so, hmm if it wasn’t the hitpart terrain, it wouldn’t return true
Please, anyone knows how to detect terrain material with RayCasting?
Is this a bug??
I used the normal way of Raycasting
, it works perfectly as it should. Here’s how:
-- This script is in StarterCharacterScripts
local character = script.Parent; -- Getting the character which is the parent of the script
local runService = game:GetService("RunService") -- Getting RunService
runService.RenderStepped:Connect(function()
local ray = Ray.new(character:WaitForChild("HumanoidRootPart").Position, Vector3.new(0, -50, 0)) -- Casting a ray
local part, pos, _, material = workspace:FindPartOnRayWithIgnoreList(ray, {character, workspace.Baseplate}) -- Ignoring baseplate and character
if part then -- Checking if the part exists
print(part.Name) -- Prints (Terrain)
if material then -- Checking if the material exists
warn(material) -- Prints (Enum.Material.Grass)
end
end
end)
Didn’t new it returned a 4 parametter returning terrain, thanks! <3
wait… what about new WorldRoot:RayCast()
That’s what I need to know
It returns the same or no?
Because, RayResult.Material on terrain returns Enum.Material.Plastic
I tried using workspace:Raycast()
, but it returned everything same as you. The material was even Plastic, but it’s fine on Ray.new()
.
Weird, My trust level ain’t enough yet… could you report on engine bugs?
My trust level also isn’t enough yet, also can you please mark that as a solution if that helped?
Use RaycastResult.Material
instead of RaycastResult.Instance.Material
.
I used that, it just printed plastic.
No, you did not. thirtycharacters