unity 3d student

Challenge C02 (Beginner)

Using what you have learnt from the modules listed below, construct a game mechanic whereby if the player presses the Space bar, a box is dropped onto a seesaw, catapulting another box at a box, which it destroys, and plays a sound.

Good Luck!

Share via Social Media

  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Add to favorites

57 Comments

    nice!, exist a website to upload owns creations for compart results?

    • You can post links to your results in the comments if you wish, or if you’re able you could post onto youtube and post a link to that?

    I’m trying to figure out which lesson will teach me how to make a seesaw.

    how do you get the seesaw to move in the correct way? Having it rotate in the air without having gravity pulling the entire thing down.

    • Hi David, the seesaw is something made using a joint so just take a look through the list and you should see which of the required modules will teach you that. Also, as a further clue you already mentioned ‘without gravity’ so take a look at your rigidbody for the seesaw and you should be able to figure it out! good luck!

    Hi Will

    You have a nice concept to teach!
    But this quest is driving me crazy with the seesaw… Anymore further clues please?

    Regards

    • Well what do you have so far?

    I tried adjusted the mass & gravity …
    and make the an invisible holder for the seesaw and trying to make it very light.. but it ends up jumping together with the box when the second box is launched…

    Thank you!

  • I’m having problems with the seesaw too. 🙂

    For starters, I use an empty gameobject with a box collider to give it a pivot on which to balance the weight of the two boxes. Is that a wrong approach in this case?
    Also experimented with different mass settings for the seesaw itself to keep it from flying away after you drop the box with space to no avail.

    This is the best result I got so far:

    http://www.youtube.com/watch?v=eOUOBV8UYBE

    I made the box you drop heavier, else the other box or the seesaw wouldn’t have moved very much.

    • Okay- take a look at the list of required components- which have u not used? That should be the clue you need.

    I decided to go through with it regardless of the seesaw issue just so I can have it finished when demonstrating. Here is my result:

    http://www.youtube.com/watch?v=iC3L1UJuiJ0

    About the required component: the only thing that comes to mind would be adding a hinge joint to the pivot on which the seesaw balances the crate weights.

    If that’s the case, I do get a better result (even though the seesaw still moves around oddly, but I can probably fix that with some mass settings tweaking), here it is:

    http://www.youtube.com/watch?v=KfGt-PUN-9I

    I also modified the pivot gameobject to hold a capsule collider here in the second video. In the first one, it has a box collider.

    • Take a look at the settings of your ridibody.. and get rid of things under the seesaw… 🙂

    This is what I managed to do: http://www.youtube.com/watch?v=m2Owbp4ioyw

    I’m stuck and I don’t have a clue where to begin in order to solve it….Grrrrr….

    • Panos – looks like you’ve missed a crucial part here – look at the list of required modules below the challenge and spot what you’ve missed!

    Of course you are not talking about the wall and sounds etc. right? ’cause I am trying to make the seesaw perfect and then move on to those…

    • Correct. What would make the seesaw pivot properly..? look at the modules!

    Ok, I did it. I checked the Is Kinematic at the pivot object and increased the mass of the falling cube. Was that the correct way to do it? It got the job done but just wanted to know if this is the best answer…:)

  • Hello,

    Firstly, thank you very much for the educational quality of the site!
    A complete solution of the challenge would be welcome.

    My cube passes through the target if I increase the weight ?

  • It took a bunch of fiddling with the physics, but I got it (proving that it can be done by someone besides you Will!)

    You’ll just have to believe me when I say it plays a sound.

    Have a looksee:
    http://www.youtube.com/watch?v=KMgs_oTgPtE

  • I got a FULL catapult working. It required a mass difference of 1:25 while real see-saw catapults only require a difference of 1:4, so I suspect the physics engine in Unity is less than super-precise. I’ll try a jointed solution next.

    http://www.youtube.com/my_videos?feature=mhum

  • So I managed to make the seesaw, but I don’t get why it works the way it does. At first, it just falls down, til I connected it to air space, but after that, it only flipped sideways. Why does it do that, and is there a way to make it flip on the other axis?

    I remedied it by literally changing the axis’s length and then spinning it. But I’d like to know if there is another way to do so, as that way just seems to be incredibly arduous and not really a fix but more of a work-around.

    • Doesn’t sound like you did it correctly to begin with – are you using a non-gravity based rigidbody with a hinge joint? this should fix it, as you put it ‘to air space’ but it should not flip anywhere – simply pivot around the hinge?

    Well, in your example, I take it that it would flip if there was no ground to interfere with the pivoting correct? That’s basically what happened to mine. It pivoted but on the short side which isn’t long enough to touch the floor.

    Then what I did was change the axis and stretched the sides that was pivoting to be longer so it’ll touch the ground while the side that didn’t shorter, then rotated it.

    My settings are as shown here:
    http://yfrog.com/c8seesawsettingsp

  • guys i think i did it but i didn’t find any good sound or material i was bored… 😛

    http://www.youtube.com/watch?v=UCzeqDs6dfw

    for the cube….

    var stars : ParticleEmitter;
    var myClip : AudioClip;

    function OnCollisionEnter(myCollision : Collision)
    {

    var wall = gameObject.Find(“Wall”);

    if (myCollision.gameObject.name == “Wall”)
    {
    Destroy(wall);
    Instantiate(stars, wall.transform.position, wall.transform.rotation);
    AudioSource.PlayClipAtPoint(myClip, wall.transform.position);
    }

    }

    and the spawncube(which u can’t respawn it :P)

    var thePrefab : GameObject;
    var shooted = false;

    function Update ()
    {

    if(Input.GetButtonUp (“Jump”) && shooted == false)
    {
    var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation);
    shooted = true;
    }
    }

  • can someone please post a complete answer, or at least make a video on how to make this? thanks in advance…

  • I got it done but there is a problem with my seesaw I have the vertical bit attached to the platform via a fixed joint but when I play the scene it wobbles about like if it is attached via a spring joint.

  • Yes I got it done. However I used a different approach. I figured that the wobbling was because only one piece had the fixed joint attached (The vertical bit was fixed to the base but the base was not fixed to the vertical bit) so I attached a fixed joint to the base of the seesaw and connected it back to the vertical bit so in the end I had a fixed joint on both pieces holding each other together which worked. However, the hierarchy way is definitely a lot simpler.
    Side Note: Too bad I lost that totally random side effect where the box bounces off the target onto the floor and straight into the camera. I doubt I would be able to replicate it without a lot of tweaking.

  • Im also quite confused with this one. Well i’ve tried making the seesaw in three parts: the top part and half the base of the seesaw, a middle part and another base. All of them joint by fixed joints and the middle piece has and empty hinge joint. The problem is that when i launch the cube the end of the seesaw without top starts to wobble like if it were a srping

    • You’ve made the mistake many people seem to make – do not use a joint for anything but the seesaw hinge, the end of the seesaw should simply be a child object of the plank.

    DONE! =)

  • I think i got a pretty nice result 🙂
    http://www.youtube.com/watch?v=jwamlsIWglI

  • 🙂 I did it! Thanks again for tutorials.

  • Hello
    Please i’m stuck, i have made my seesaw my ball and the other thing, but when i try to flung the cube out, it can’t be done, should i enable the gravity? what can i do to make the new objet when it touch the seesaw, lunch the other cube

  • 2 in 1 day. Wow these tutorials are good. Here is mine. You will see my little problem however…

    http://youtu.be/bmzKxuZVvUU

    why is the backend of the seesaw moving around. It has a rigidbody component with gravity and a fixed hinge on the seesaw. I don’t necessarily need the help, because it’s very minor. I am just glad your tutorials are a great help. Thanks

  • http://www.youtube.com/watch?v=q1z2v5NnCqQ

    my catapults system doesn’t work like the one in the video. My video is not clear but i can describe what happens. The vertical part of the seesaw is not strictly attachet to the horizontal part, so when my cube falls onto it, it does not move with the horizontal part as strict as i want, it kind of vibrates. I used fixed joint to attach them. Hinge joint also gives the same result.

    How can i fix this ?

    • Everyone makes this mistake, truth is there is no need for a joint to attach the vertical point, tho its fascinating to see everyone try! Probably because I list joints – purely to show people about the hinge though really. Note that I also include the video about the Hierarchy, and therein lies what you need to attach the two parts together.

      • Thanks for your answer.

        I fixed that but still have some issues here. I’ll try to list them:

        1. How Can i fix an item into 3D space from a specified dot? Just like “Constraints” but i want to fix from wherever i want, not from the bottom of it? I thought maybe i can use a thin stick and use it like a support with parent-child , but it somehow breaks the support and gets out of control.

        2. the box doesnt drop down fast enough. for that i increase the gravity,but if i increase the gravity and drop the second box, the first one goes through the horizontal part of the seesaw just like a ghost when the seesaw moves up. I think i cant set it up to be rigid enough.

        Thanks.

    I’ve achieved the success 🙂 Although some of my issues remain.
    I used hinge joint to fix the seesaw on a position.
    I didn’t use Materials, since i didn’t know where to use.

    http://youtu.be/s0O08QOaamo

    this is my result. Quality is really bad, but it gives a clue. (Although on collision sound starts but recording is without sound 🙂 )

    I think ill be truly a student of this website 🙂
    Thanks!

  • Hi!

    I’m having trouble with the seesaw. I added a joint to a empty gameobject but it doesn’t work. Help?

    • You’re doing it wrong. Go back and look at exactly what I’m showing in the listed modules.

    i got mine to work, but one problem. i cant fling it very high???

    • do i just lower the mass of the other cube? movement still seems a lil slow

    • change your forces! or adjust mass – just remember that your gravity setting is global and should not be changed.

    […] первой задачи. Ссылка на оригинальное задание: http://www.unity3dstudent.com/2010/07/challenge-c02-beginner/ Суть: нужно создать сцену, в которой по нажатию […]

  • I’m having a sticky problem. My cube falls onto the seesaw, but gets stuck inside it partly. Then when I drop the 2nd cube, sometimes it collide with the seesaw, sometimes it doesn’t. If it does, then the first cube drops through the see-saw instead of getting flung. The seesaw is 1.5 units thick.

    Also, even though I made the back of the seesaw a child of the seesaw, it wouldn’t move. I had to attach a fixed joint. On my seesaw I had to check freeze position for x,y,z and freeze rotation y,z for it to act as a lever at all (I have a sphere under it with a hinged joint to the seesaw.

    I’ve tried all manner of placement, mass, and rigid body configurations.
    What’s “supposed” to work best? Thanks!

  • Hi,thanks for the great tutorial!
    I have everything working, but my seesaw is wobly and it lifts itself from the hinge I created. What can I do to stop that?

    Thanks.

  • Cool beans! Just a bit of playing with the masses and it all works splendidly! Cheers! =)

  • I got a problem. I used the seesaw and backboard as a hierarchy. I’ve used a fixed joint to the seesaw and attached it to the backboard. I tried to use gravity on the backboard, but the backboard takes the whole seesaw up in the air. Also, when I tried to use gravity on the seesaw, it just falls to the ground. I’ve tried to adjust the mass for the backboard and seesaw, but no luck. I’m lost, I need a hint.

  • to solve everyone’s problem with the weird rotation thing, highlight the entire seesaw and go to Rigidbody > Constraints > check the x rotation only. Hope this helps 😀
    After this if youve got the rest, it should work. I can tell you more if someone needs.

  • I made a seesaw along with the cylinder but when the second cube falls it breaks apart.How do i fix the cylinder to one spot?

    • I got it but cant catapult it far enough.I tried increasing the mass but its not working.I also tried to reduce the other box mass but it still dindt work

    1-i made both parts of the seesaw with cubes and made one of them a child of the other the problem is the child can’t seem to remain attached to the parent without adding a fixed joint.
    as for the seesaw i just fixed the rotation axis for both parts making them unable to rotate on other axis aside from the one i want, with this i don’t have to use a hinge joint (is this solution correct or do you think i should add the hinge joint).
    2- i can’t seem to make the cube fly toward the wall unless i raise the mass of the spawned one by ten folds and even with that at some occasion the cube goes through the seesaw instead of flying towards the wall…. any explanation to that?

    By the way i just started the tutorials, great job!!

  • https://www.youtube.com/watch?v=ONTvxiU8C0Y……I only used constraints to control the motion of seesaw….if you want me to make tutorial on it then comment it on my video…thanks for watching!!!!!

  • https://www.youtube.com/watch?v=ONTvxiU8C0Y……
    I only used constraints to control the motion of seesaw…..if you want me to make a tutorial on it please comment…THANKS FOR WATCHING!!!

Leave a Comment