I’m trying to create a terrain scanning effect, which scans the surrounding terrain and points out any special items - very similar to this:
I have the system setup however I just need some ideas as to how I can create the scan, I’ve thought of using a tweening part and then continously checking GetTouchingParts - I’m not sure if that’ll work though.
I know raycasting could also be used here but I’m not sure how.
Any ideas are appreciated!
I would add BillboardGui with an red dot image for example (visibility should be set to false and also AlwaysOnTop mode on ON) in this special items and give them in same folder in workspace. Once player activates terrain scanner it would do for i,#specialitems do in selected folder of course and turn visiblity on true. Also you will have to use RemoteEvents to do this. After some time while valuses are set to true, those values should turn back to false.
AlwaysOnTop (BillboardGui) mode should be set to true I think if I remember correctly it should be visible truth the terrain surface as well.
I am confused about which outline are we talking about also.
You might be able to do something with glass and duplicating each part, then making the duplicate slightly bigger. Maybe this is even possible with the ForceField material? Otherwise I don’t think this is possible with the current Roblox engine.
Hm, yeah that one is interesting well. You will definitely have to use TweenService. I’d do it maybe something like that for example. I would use an big invisible block that can go truth whole terrain and TweenService it. Then you will have to think what happens to make terrain blue the Tweened pat should represent the terrain that was scanned. Also you will have to check if special item is inside of this part which CanCollide should be turned to off.
@Intended_Pun@ArticGamerTV
I was able to get it to work using some PhysicsService collision groups and some Tweening along with a while loop continously checking the GetTouchingParts.
Here’s the code if you’d like to see how:
PHYSICS_SERVICE:CreateCollisionGroup("MyDefault")
function scanEffect(hrp)
local position = hrp.Position
local outline = script.Outline:Clone()
local outlineParts = {outline}
local workspaceParts = {}
PHYSICS_SERVICE:CreateCollisionGroup("Outline")
PHYSICS_SERVICE:CreateCollisionGroup("Workspace")
PHYSICS_SERVICE:SetPartCollisionGroup(outline, "Outline")
for _, object in pairs(hrp.Parent:GetDescendants()) do
if object:IsA("BasePart") then
PHYSICS_SERVICE:SetPartCollisionGroup(object, "Workspace")
table.insert(workspaceParts, object)
end
end
PHYSICS_SERVICE:CollisionGroupSetCollidable("Outline", "Workspace", false)
local finished = false
local tween = TWEEN_SERVICE:Create(outline, TweenInfo.new(2), {Size = Vector3.new(100,3,100)})
outline.Position = hrp.Position - Vector3.new(0,0,-3)
outline.Parent = workspace
tween:Play()
tween.Completed:Connect(function()
finished = true
end)
while not finished do
local touching = outline:GetTouchingParts()
for _, v in pairs(touching) do
print(v, "hit!")
if not v:IsDescendantOf(hrp.Parent) then
print("clone it!")
local clone = v:Clone()
clone.Material = Enum.Material.ForceField
clone.Color = outline.Color
clone.Size = v.Size + Vector3.new(0,0.5,0)
clone.CanCollide = false
clone.Parent = workspace
table.insert(outlineParts, clone)
if table.find(SPECIAL_ITEMS, v) then
script.ItemFound:Clone().Parent = clone
elseif table.find(SUPER_SPECIAL_ITEMS, v) then
script.SuperItemFound:Clone().Parent = clone
end
PHYSICS_SERVICE:SetPartCollisionGroup(v, "Workspace")
table.insert(workspaceParts, v)
end
end
wait()
end
print("Done!")
print(unpack(workspaceParts))
for _, part in pairs(outlineParts) do
part:Destroy()
end
PHYSICS_SERVICE:RemoveCollisionGroup("Outline")
PHYSICS_SERVICE:RemoveCollisionGroup("Workspace")
for i, v in pairs(workspaceParts) do
PHYSICS_SERVICE:SetPartCollisionGroup(v, "MyDefault")
end
end
If you’re looking for something relatively simple you can use
The ForceField Material
Export to obj to create an obj file from your terrain (it will be textureless)
A MeshPart of your terrain
Use ForceField animations from here to create a sweeping motion
Finally you can position/scale your mesh over the Terrain and make the object visible when you play the scanning effect. This has no use of TweenService and I believe gives a similar effect to the one shown in the video. It should be pretty performant as well.
Thanks for the idea however the system I’ve built seemingly works fine.
I doubt the ForceField effect would create the scan like effect too, the animations on it only start after around 5 seconds.