How to make a creating "Domain Expansion" effect?

So i was trying to make an Domain Expansion for my game. I wanted to make it smooth but I didn’t found any way to achieve this transition(?) while creating an domain.

in the video, the circle slowly appears. how can I make that?

1 Like

Do you mean the glowing white effect?

From what it looks like the the video, they do raycasts around the player a bunch of times and place neon colored meshes based on the raycast hit position and the raycast normal (they might also have it just have the code assume the ground is flat, though that only would work in the baseplate). If the raycasts don’t hit then it just places the mesh facing the character at the distance of the raycast (for example, if you wanted a bubble of size 50, you’d raycast 50 studs).

1 Like

how can i do that? can you give me any code reference by any chance?

I don’t think it would really be practical in an actual game, because it would be really complex to try and completely cover more complex surfaces (not something that’s just flat, consider trees for example) without using a very large amount of neon parts (which tend to be more laggy).

If you see the transition at the end (0:11), you might want to consider that one instead–the performance cost of that would be fine–you’d just tween a bloom effect:

-- Make sure to add a bloom effect named BloomEffect to Lighting
local bloomEffect = game:GetService("Lighting").BloomEffect


local TweenService = game:GetService("TweenService")
local inTweenInfo = TweenInfo.new(2, Enum.EasingStyle.Exponential, Enum.EasingDirection.In)
local function animateIn()
    TweenService:Create(bloomEffect, inTweenInfo, goal = {Threshold = 0, Intensity = 100})
end

Then to get the animation you want going out (look at 0:07) after you teleport the character somewhere far away, you spawn in a dome of neon white parts then tween all of their sizes to zero.

1 Like

i meant the neon parts’ code because i dont knwo how to code that one

1 Like

Outside of an actual game (since this only would work for baseplates), if you want to make that effect, you can do something like this:

local radius = 20
local character -- get the character
local groundPos = character.HumanoidRootPart.Position - Vector3.new(0,2,0)

local randonXAngle = math.random(0, 360)
local randonYAngle = math.random(0, 360)
local randonZAngle = math.random(0, 360)

for i = 1, 200 do
    local newCFrame = CFrame.angles(math.rad(randonXAngle), math.rad(randonYAngle), 
    math.rad(randonZAngle))
    newCFrame = newCFrame + newCFrame.LookVector * radius + groundPos
    local partCFrame
    if newCFrame.Y < groundPos.Y then
        partCFrame = newCFrame - newCFrame.Position.Y * Vector3.yAxis
    else
        partCFrame = CFrame.lookAt(newCFrame.Position, groundPos)
    end

    -- TODO: Make a new neon part with `partCFrame` here with size 0
    -- TODO: Make+play a tween to make the size grow to something like Vector3.new(8,2,8)
end

This would be an easy way to do this, raycasting and smarter placement gets more complicated.

Edit:

This is a very good idea!

I don’t think they’re doing this for the ground:

Screenshot 2024-03-12 at 12.26.18 PM

Notice how the particles are flat on the ground, not facing inwards.

But for the other sphere this would be a perfect way to do this! (The ground could be done with a second disk-shaped emitter with orientation set to world up!)

You can make the effect close in around the two characters using a sphere shaped particle emitter (set to surface) and tween ShapePartial to get the closing effect.

Hypduh is definitely correct that this is how the effect is done. Using particles would also be reasonably performant too!

It would still run into the problem on non-flat ground where terrain could poke through, but that’s pretty unavoidable.

1 Like

both of the aforementioned solutions might work, but they are not what was done in the video. the video uses a particleemitter with the shape property set to sphere. you then tween the shapepartial property from 0 to 1.

2 Likes

that tutorial is too complex for my brain… oh dear

2 Likes

I found a method with particle effects. Take any particle effect texture and do:
Orientation: VelocityPerpendicular
Shape: Disc for bottom layer, Sphere for the dome
ShapeInOut: Outward
Shape Partial: 0
ShapeStyle: Surface.

Then make the shape partial go up by 0.1 every 0.1 seconds.

Make sure the bottom layer is a normal part and the dome is a sphere

2 Likes

thank you so much ╯︿╰
this means a lot to me

how do i “make the shape partial go up by 0,1 every 0.1 seconds.”?
it sounds simple enough but i’m not sure about this part- also, anything to do with particle effects feels so confusing ┗( T﹏T )┛

Run a loop that could look like this:

for Iteration = 1, 10 do -- 10 Iterations, Iteration count goes up by 1 each time the loop ends 
     Particle.ShapePartial += 0.1 -- Assuming that Particle is the particle you are using 
     task.wait(0.1)
end