Making a Sweeper Bar

I’m building a game where a major part of it are “Sweeper” bars. I was wondering what the most stable methods would be (constraints, cframe, etc) for making a rotating Sweeper bar that can push players around, like this;

4 Likes

Avoid CFrame, since it skips the whole physics stuff (idk the details there), thus you would end up with a bar intersecting the player instead of pushing.

You could connect it to a motorized hinge constraint. Alternatively, you could use a combo of body movers. I would probably go with the hinge constraint first and see if it works well.

1 Like

My concern with HingeConstraints is that they could be a little glitchy when it comes to dealing with multiple players at once (unless they’re more stable than when I last used them)

1 Like

When I have motorized assemblies interacting with multiple players like this, assuming they are fairly simple, I’ve been letting the server have network ownership of the motor, by setting the owner to nil. Before I did this, I observed some undesirable things happening, like the first player to come in range would get ownership, and if they happened to be on an Xbox or toaster PC, everyone suffered. Conversely, if a player with a decent PC gets ownership, things run more smoothly, but the simulating player potentially also has a competitive advantage of seeing things go much more smoothly and with less lag. So I make things fair by letting the server handle it.

As Crazyman32 notes, don’t do CFrame animation on the server. The client can’t interpolate this, so it will look very choppy.

6 Likes

When I use a HingeConstraint and set network ownership to the server, the bar doesn’t push players around like I’m aiming for.

1 Like

What’s your MotorMaxTorque at? That could have an impact on how effective the sweeper is on pushing objects.

Edit: Nevermind. Just tested, it won’t push even with a MotorMaxTorque of inf. Maybe you’ll just have to create a sweeper for each player’s own client, if it must actually push them. Chances are, most or all cases someone could exploit around this, they could exploit around it if it was on the server anyway.

You could always opt for different effects though, such as tripping players when they’re hit by the sweeper to make them fall off.

1 Like

I would honestly just rig that bar and give it a looping animation. That way it’s also interpolated.

2018-01-25_18-40-05

1 Like

You can try to use tweens instead

I’m not sure if tweens are interpolated and if characters standing on a tweened part move with the part. If they do, then tweening is also a good solution.

I think they are but I can’t be too sure. Possibility I guess

I haven’t had very good expriences with TweenService, mostly waiting for the Completed event. It seems like when it arrives there, it’s never let me run another tween on the same object directly after.

If animations work they definitely sound more promising than tweens, from my past experience.

I love TweenService it’s just that one thing really bothers me and makes it unusable for a lot of things I wish I could use it for.

Edit: Seems this bug is actually fixed. Not sure when that happened since I haven’t needed it until now.

Yeah agreed

if you want them to fall off, you could set their Humanoid to Sit and they’d be pushed off.

1 Like

I mean, I’m not the poster of this thread. But just making them sit isn’t enough. They could get back up if other precautions aren’t taken.

it’s not the best way and I agree, but surely if you were to loop it a couple times they would have no means of getting up back onto something. it solves the issue of stopping the bar dead in its tracks though.

invisible explosion?

1 Like

Looping doesn’t sound like the best solution. Maybe disable the humanoid state for them to jump, then make them sit, and listen for jumping from their humanoid. If they jump or even leave the sit state without dying or anything else non-suspicious, just kick them.

1 Like

Yeah that sounds better. could change JumpPower also.

1 Like

That is very interesting. I have a lot of HingeConstraint based doors in my places, with server ownership, and they do push the players. But my doors aren’t using the HingeConstraint motor, they have an AlignOrientation that provides the force to return the door to the closed position when no one is passing through.

Even so, there are two things problematic about your stalled pusher example: 1) a player should not be able to stop something with infinite torque, and 2) the behavior of the pusher should ideally be the same no matter who has network ownership of it–network ownership should not change the laws of physics, just which computer does the calculations. So this is arguably a bug (or two).