its kinda self explanatory, i dont really know what else to say
clone them from storage then raycast from a point then place them at raycastresult.destination
how do i raycast (sorry) (character limit)
Get origin, get destination, direction = origin-destination, and also specify the length of the ray
local raycastResult = workspace:Raycast(rayOrigin, rayDirection)
You could try creating a large 2d grid and raycasting downwards from each point, then if it hits terrain and its material is rock, create a model
im still confused, and i dont think the documentation really helped
all i want to do is start from a certain point in a cave then raycast in all directions to place ores but theres no way i would know how to be able to make that
What is the cave? A terrain cave?
Ima give example… (it might not work)
local rayorigin = vector3.new(0,0,0) -- or somewhere else
local tries = 100 --a number
local tried = 0
local secondary = 0
while tried<tries do
while secondary<tries do
raydirection = vector3.new(tried/tries,secondary/tries,0).Unit*500 -- or however far away
raycastresult = workspace:Raycast(rayorigin, raydirection)
if raycastresult then
--place the part at raycastresult.position
end
end
secondary = 0
tried += 1
end
it says that in the title… eeee
i tried this
local rayorigin = game.ServerStorage.Coal.Position -- or somewhere else
local tries = 100 --a number
local tried = 0
local secondary = 0
while tried<tries do
while secondary<tries do
raydirection = Vector3.new(tried/tries,secondary/tries,0).Unit*500 -- or however far away
raycastresult = workspace:Raycast(rayorigin, raydirection)
if raycastresult then
local coal = game.ServerStorage.Coal:Clone()
coal.Position = rayorigin + raydirection
coal.Parent = workspace
end
wait(1)
end
secondary = 0
tried += 1
wait(1)
end
but it didnt work, am i doing something wrong??
can someone please help?
I don’t think you can do that… move it to workspace
Also, I typed it on devforum, make sure you indent correctly.
also any erros in the output?
i changed game.ServerStorage.Coal to game.Workspace.CoalTemplate, but to no avail.
also, no errors, and also things in the servstorage still have a position. also everything is already indented correctly.
is any coal appearing in workspace? make sure it goals to raycastresult.position
they dont appear at all aaaaaa
i found out the raycastResult doesnt even exist by using prints
You could always lay down a bunch of transparent, can collide = false, locked and anchored, coal objects wherever you wish. Put them all in a folder then have a script randomly pick one to give you the position to spawn the real coal to. Also would make them exactly where you want them to be.
No shadows and massless too.
try moving parts really close to the rayorigin, could be outta range…
its a terrain cave. i cant do that…
Try moving the origin close to the terrain first then?