Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to animate water?

Asked by 10 years ago

I'm trying to make a brick move left and right in water like motion. How can I script that?

4 answers

Log in to vote
0
Answered by
duckwit 1404 Moderation Voter
10 years ago

You can make a Part move smoothly backwards and forwards in a multitude of different ways, how close they are to approximating water all depends on what movement of water you're talking about and which method you use.

I'll describe one method that you can use to get the Part moving smoothly backwards and forwards:

First, have a look at the graph of the function sin^2(x):

http://www.wolframalpha.com/input/?i=y+%3D+sin%5E2%28x%29

Now in Roblox Lua you can use the math library to access some mathematical functions, then all you need to do is link the output from this function (over time) to the movement of your brick.

So lets start with a while loop:

while wait() do
--Process the movement here
end

... and fill the rest in:

brick = workspace.Blue --The part you want to animate

center = brick.Position --We want the brick to stay oscillating around a centre point

multiplier = 1 --How fast you want it to go back and forth

distance = 5 --How many studs you want the brick to move by each way

while wait() do
--This will move the brick in the +/- x-axis direction
brick.CFrame = CFrame.new(5 * (math.sin(multiplier*tick()))^2,0,0) + center
end

... I think it looks quite nice!

I hope that gets you started with what you were looking for.

Ad
Log in to vote
0
Answered by 10 years ago

you could just make a script to rotate the water making it move.

hope this helped!

Log in to vote
-2
Answered by 10 years ago

U dont need to animate water u can use stamper tools water its like animated

0
I wanted a brick movement not using the roblox stamper tool because it doesn't have the desire texture I needed from it. TheTiredHippo 30 — 10y
Log in to vote
-2
Answered by
Kozero 120
10 years ago

You could go on Roblox studio and play around with the tools till you find the water terrain.There are 2 types one which is only for BC or as Builderkevin25 said use the stamper tool

Answer this question