Making parts organically float

For that I wanted to use a combo of lerping and cubic bezier curves. But the problem is, for the movement to look organic it cant repeat over and over again. I would like to make it so, that once my moving part passed 1 point, this point will move to a random position within a limited radius. But how would I achieve that and what would be the best way to loop with lerping?

4 Likes

You can try with a AlignPosition and each some time change itâ€™s linear velocity or angular velocity, I think it will look good.

1 Like

no. I dont want the movements to be straight, they need to be fluid

2 Likes

I heared about bezier tweening, maybe it would help?

1 Like

Yea, I mean: Change them from Vectors with 1 of magntude each a few sec, for example:

``````local Part = script.Parent

while true do
Part.AssamblyLinearVelocity = Vector3.new(math.ramdom(1,100)/100,math.ramdom(1,100)/100,math.ramdom(1,100)/100)
wait(0.5)
end
``````
1 Like

It isnâ€™t 1 of magnitude but It will have small changes.

1 Like

isnt it gonna cause lag? And would the parts be moving how I imagined it too?

2 Likes

It wonâ€™t cause lag if the moveing is in the server since it have a lot of potence.

And I donâ€™t know how do you imaginated, I just suppost that they will move kind of organic.

1 Like

ok, my idea was that the parts will have an imperfect orbit

1 Like

If you want a orbi, jus use the Tween Service with a Circular easing style to make it pass around some points. To be imperfect, donâ€™t make the points on an exact cross. (5 sec draw:)

In this image, where the points are at the same distance frmo the center, it will be a â€śperfectâ€ť orbit.
In this one:

It will have some imperfections.
Red circles: Points to go
Green Cross: Center

1 Like

I can achieve that with linear velocity, where its like an ellipse. By imperfections I mean it has a main ellipse or circle movement, but its all jiggly

1 Like

Then I donâ€™t know what else you can do if no one of what I said is usefull. Sorry.

1 Like

I need the part to go on an imperfect path like in the drawing, each time there is a new imperfect path

1 Like

To make it go in an imperfect path you can move the part in a circle around a center with some radius and then use math.noise() to add a value to that radius

Hereâ€™s code to do it, the NoiseSize variable will control how much the math.noise() will distort the path and NoiseTimeScale variable will control how fast it will wobble

``````local RunService = game:GetService("RunService")

local Radius = 16
local NoiseSize = 6
local NoiseTimeScale = 1

local Speed = 1

local GameTime = 0

RunService.Heartbeat:Connect(function(dt)
GameTime += dt

local RadiusAdd = math.noise(GameTime * NoiseTimeScale) * NoiseSize

local t = GameTime * Speed

local Position = Vector3.new(math.cos(t), 0, math.sin(t)) * ActualRadius
end)
``````
1 Like

2 questions. 1st, is it a server script? second, will the orbit each time be new?

It can be both a server and a client script
If you put it in a client script it will be more smooth

Yes, it will

1 Like

wonderfull, but I assume that not the whole script cuz its not specific to a part? Lets say I have 4 parts, called p1,p2,p3 and p4, can I create custom orbits for all of them all at once or does this script only work for 1 part?

1 Like

Rn the script doesnâ€™t support custom orbits, it only supports a circular orbit

1 Like

by custom I meant that each of the 4 part have an orbit of their own, still circular though

1 Like

Oh, the script is for a single part
Iâ€™ve made an updated script which has a function to make a part orbit another part and you can call it every RunService.Heartbeat for the parts you want to orbit and you can give each of them a different Radius, NoiseSize, NoiseTimeScale and Speed

``````local RunService = game:GetService("RunService")

local GameTime = 0

local Radius = 16
local NoiseSize = 6
local NoiseTimeScale = 1
local Speed = 1

local function UpdateOrbitPart(Radius, NoiseSize, NoiseTimeScale, Speed, MovingPart, Orbit)
local RadiusAdd = math.noise(GameTime * NoiseTimeScale) * NoiseSize