2D See-Saw - Need Guidance

TL;DR: I need some advice on how to make a see-saw in 2D that alternately launches its riders into the air when one lands on it properly.

(I’m not sure if this post is going to end up in the right place, the topic creation interface is pretty confusing. Hopefully a mod will move it if need be.)

So I’m trying to make a game similar to the old Circus Atari! game (you can look up videos if you are interested). Basically, I need a see-saw that the player controls along the bottom of the screen and two acrobat ‘objects’ that alternate jumping to the upper part of the screen to break blocks/grab objects, etc.

Right now I’m just trying to get started and get the see-saw working and it’s been a long time since I did any game dev, so I’m somewhat at a loss. So far I have a triangle for the fulcrum and a box for the bar. I tried using the built-in hinge feature to get it working just with physics but it went a bit screwy and was rotating the bar’s collision box separate from its sprite and I couldn’t figure out why. So I am scrapping the hinge and just going to code it all myself, I guess (which is probably for the best).

So what I need from you fine people is some idea of where/how to start. My current plan is to have a collision box on each end of the bar which detects when an acrobat collides with it and snaps them to that end of the bar while rotating the bar and launching the acrobat from the opposite side of the bar into the air. I already have the fulcrum moving back and forth with player input (though I have no idea if I did it in a good way). I’m just having a hard time getting back into this and hoping someone can give me a nudge in the right direction, at least.

I just did a little test to see what it would be like using physics. For the seesaw I used a circle collider for the pivot and a box collider for the board which was a child object of the pivot. No joints necessary. The only tricky thing you’ll need to do is increase the mass of the falling acrobat and decrease the mass of the acrobat that’s waiting on the seesaw.

1 Like

This is exactly what physics is for but you’re scrapping using it because you had a problem with a renderer is quite strange. Physics does not break renderers so instead of scrapping using physics, just try to figure out how to use the renderer correctly. It just sounds like you have stuff mixed up in the hierarchy.

A GameObject with a Dynamic Rigidbody2D and a HingeJoint2D will pivot perfectly well. Add a collider to it (maybe a BoxCollider2D) and you’ll gave an area to collide with. Anything touching that will cause it to pivot i.e. the body wil be constrained by the HingeJoint2D (it’s job).

Add a SpriteRender2D to it to render the same area as the box and it’ll work pefectly fine.

Also, you should clone my PhysicsExamples2D Github repo which demonstrates how to use lots of the physics components as well as various integration examples.

In there you’ll find a basic “SeeSaw” example scene. When you hit play it should be perfectly balanced but if you disable some of the things resting on it then it’ll act as you’d expect:

Note: Each branch is a specific Unity version with the master being Unity 6.

Thanks for the replies, this is good info that I’ll definitely look into. I’m only a passable programmer (I think) and like I said, it’s been a long time since I’ve done any game dev, so I’m feeling very rusty as I try to get back into it. I have a lot to learn, I admit.

Np good luck. Note though that the above example needs zero code so it’s easy to setup.

1 Like

First of all, Circus Atari is a fantastically simple yet fun game to make.

But Circus Atari does not use a generic physics engine in the sense that we have in Unity. We didn’t have that kind of CPU power or software back in 1981 or whenever this came out.

Instead, I’m sure it was coded far more simply: either you have the seesaw positioned in a “close enough” spot that the falling clown is able to hit his seat and it launches the other clown, or else it fails and the falling clown goes splat.

The position of the falling clown relative to the “zero” of where he’s supposed to sit may or may not be used to aim the launched clown, or perhaps to control his ultimate height.

The left-right motion of the seesaw assembly at the moment of contact may also control the clown launch angle.

This simple approach almost certainly will provide a far more predictable gameplay experience than trying it with physics.

Trying to make Circus Atari with real physics might be kinda cool, but be prepared to do a LOT of fiddling. The physics engine is great at ballistics and single contacts, things moving at relatively slow speed, impacting gently, and it gets steadily worse the more things are in closer and closer contact, going faster, slamming harder.

This means that simulating one clown on a teeter connected to a hinge joint, and another clown slamming into the far side of the seesaw is going to be an extremely unstable setup, one that will likely need additional code to guard and limit the velocities and impacts to get a suitable gameplay.

You may wish to try a simpler approach, just using tweeners and code to simulate the original way Circus Atari does it, doing all your own physics. This approach is far more likely to result in a rewarding game

If you do try to use physics, you’ll also need to control the arrival and departure of the clowns, probably locking the incoming clown to the seesaw with some kind of joint, while simultaneously unlocking the other clown.

This is why I said it is probably for the best that I just code it myself instead of using the hinge joint and built-in physics engine. I will still probably end up using this approach, I’ll have to fiddle with it and see. I’m mostly just doing this to learn how to do it and to try to actually complete a solo project, heh. So the simpler the better for this project.

1 Like