[SOLVED](no scripts)Is it possible to make a wrecking ball swing forever by just using mechanical constraints/physics?

hope i choose the right category for this.

I had this idea earlier today and wanted to know if it is possible, i tried searching to see if it was possible but i could not found anything, i even tried to make my own using hinge and spring constraints, the thing is that if the player starts to interact with the ball it will stop eventually.

1 Like

It’s a good idea to use blender and use physics to make it swing.

i want to make it swing forever and push players of a platform without the use of scripts, just using constraints/physics.

1 Like

Try using the Roblox Documentation to help you out.

From what I know in Roblox balls (on flat ground) go on forever (unless there’s something stopping them anyway)
So I think this would be achievable, but I’m not sure if it’s possible, I think this might work with HingeConstraints

This seems like code golf, except with roblox physics instead of code.

One way to do that might be to prevent anything else from interacting with the pendulum.
Remove the pendulum’s collision, then attach an extra collideable pendulum to it using an AlignPosition and AlignOrientation with rigidity enabled and reaction force disabled. The pendulum can now interact with other things, but other things cannot affect the pendulum’s trajectory.

Another might be to use some other mechanism to drive the pendulum:

(except invisible)

The third option is to just do it in a script. I assume you’re not doing that because it doesn’t set velocity, but you really can just set the velocity of the parts to match the movement.

edit: I’m referring to the wrecking ball as a pendulum because that’s what its movement boils down to

1 Like

the “no script” part was because of lag issues, Roblox physics replicate to all players locally which means it does not require a player to have good connection speed to pass a certain part in the game, even if he had like 500 ping or more the ball would move perfectly and smooth, if i do it in a script, the ball would just stop and suddenly teleport to another position a lot of times, i don’t want that to happen, also your first idea seems good, i will try that and see if it works.

1 Like

(Well, anyway the rest of the Game will not work anyway)

It’s actually a smart thing, only thing is that if you don’t want to have differences when having different Internet connections is that the wrecking ball/everything that only uses physics and the things that use scripts will be smooth/laggy, which might not be the best

1 Like

Just after reading your post, I went to Roblox Studio to experiment with physics constraints. I don’t know anything about most of the constraints. But I still added a hinge and a line force in two parts. I started experimenting with them. And I made something cool that comes back when moved away.

So, since I’m learning to script, I wanted to make the same thing with scripts. And then I started making an instance for all of them. But since Roblox connects the constraints automatically, and I didn’t know I had to connect the attachments, I asked ChatGPT for help. It helped me and connected my attachments. Then I saw it worked. But then I noticed that the thing I made actually swings forever. As of right now, it’s still swinging in my Roblox Studio lol. Here’s a demo:

And the script I made:

local holder = Instance.new("Part")
holder.Name = "Holder"
holder.Parent = game.Workspace
holder.Color = Color3.fromRGB(52, 52, 52)
holder.Material = Enum.Material.SmoothPlastic
holder.Position = Vector3.new(0, 10, 0)
holder.Anchored = true

local ball = Instance.new("Part")
ball.Name = "Ball"
ball.Parent = game.Workspace
ball.Color = Color3.fromRGB(255, 0, 0)
ball.Material = Enum.Material.SmoothPlastic
ball.Position = Vector3.new(0, 5, 0)
ball.Anchored = false
ball.Shape = Enum.PartType.Ball

local hat0 = Instance.new("Attachment")
hat0.Name = "hat0"
hat0.Parent = holder
hat0.Position = Vector3.new(0, 10, 0)

local hat1 = Instance.new("Attachment")
hat1.Name = "hat1"
hat1.Parent = ball
hat1.Position = Vector3.new(0, 5, 0)

local hinge = Instance.new("HingeConstraint")
hinge.Parent = holder
hinge.Attachment0 = hat0
hinge.Attachment1 = hat1
hinge.Position = hat1.Position

local lat0 = Instance.new("Attachment")
lat0.Name = "lat0"
lat0.Parent = holder
lat0.Position = Vector3.new(0, 10, 0)

local lat1 = Instance.new("Attachment")
lat1.Name = "lat1"
lat1.Parent = ball
lat1.Position = Vector3.new(0, 5, 0)

local lineForce = Instance.new("LineForce")
lineForce.Parent = holder
lineForce.Attachment0 = lat0
lineForce.Attachment1 = lat1

I mean you can’t expect great code from a beginner…

Update: It still didn’t stop, after a long time, but it did slow down. But when I touched it a little bit, it started moving fast again… I think you need one big part or something that moves all of the balls together when the ball slows down. But you should experiment yourself too…

Also, I’m interested in constraints a lot. If anyone has any tutorials/links to Roblox Guide, then please reply to me. I want to learn more about these constraints!

1 Like

That’s actually what the OP is looking for (I think)
Good job!
Also if you want to know more about constraints I suggest you look at the Documentation, that’s where I found all the info about them

1 Like

In that case, move the wrecking ball in a LocalScript based on time() or DistributedGameTime or whatever (so that everyone will see the ball in roughly the same place). This will remove the network from the equation entirely.

However, the wrecking ball will not be moving server-side, so it won’t knock around server-owned parts and will just pass through them.

I think it’ll stop at a time, in my opinion. Because it was getting slower and slower. It was my first time experimenting with Roblox physics. I’m looking up constraints on Roblox documentation, thanks!

can you explain me how to do this?

Good News Everyone!, after thinking a lot about it i finally figure it out!

i once found a model that the owner used a Animation Controller to make it move, so after a little bit of research on that, i created a animated wrecking ball that swings back and forward in a loop and played it using a server script, and it was PERFECT! then for the final test i got my old model that just change the position and put it side by side with my new model, then i played the game on my phone and then I walked away from the wi-fi router, the game got around 10k ping and the animated ball was working perfectly!(the old one did not even move lol.)


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.