Search Unity

Strange behavior in 2D platformer tutorial

Discussion in 'Editor & General Support' started by cognitron, Jul 31, 2011.

  1. cognitron

    cognitron

    Joined:
    Jul 31, 2011
    Posts:
    3
    Hi guys, sorry if this has already be addressed, I did search the forums first.

    I'm doing the 2D platformer tutorial using Unity 3.4. Everything works, but I get really strange behavior from the crates. When you first start the game they're fine, but as soon as one falls off the edge and drops off the screen (hitting the death zone I imagine) it starts flying all over the screen really fast and bouncing off of things. If it lands back on the platform and manages to stay put (sometimes it sits there for a split second then decides to go flying around again) it will kind of vibrate and hop around a little. I'm guessing this has something to do with the rigid body?

    Thanks for any insight anyone has,

    Matt
     
  2. zine92

    zine92

    Joined:
    Nov 13, 2010
    Posts:
    1,347
    Trying it later, will report to you if i find anything. :D

    Anyways i realized the problem isn't with Unity's rigidbody because i tried using a blank project and creating some cubes and make then bounce with rigidbody. I am thinking might be the way it is scripted. Going to take a in depth look later. :D
     
    Last edited: Aug 1, 2011
  3. cognitron

    cognitron

    Joined:
    Jul 31, 2011
    Posts:
    3
  4. cognitron

    cognitron

    Joined:
    Jul 31, 2011
    Posts:
    3
    In case anyone else comes across this, here's how I fixed it. Seems that some things have probably changed in Unity since this tutorial was made (Unity 2).

    1. Remove the configurable joint components from the crate and spaceship prefabs. Also from the ball if you followed that step. It should be gone from all your instances now. If you changed them, and they're no longer linked to the prefab, go remove this component from them.

    2. Rigidbody has Constraints options available in the inspector that I'm guessing were added after this tutorial was made. For each of the prefabs(or individual props you're using) set Freeze Position to Z, and Freeze Rotation to X and Y.

    3. Run your level. Should work fine now. In scene view I noticed that crates that fell off the platform are just sitting down there on the death zone. Should probably destroy them when they hit it if you have a very big level with lots of props that can fall.
     
  5. CMoss

    CMoss

    Joined:
    Apr 21, 2009
    Posts:
    75
    It looks like the 2d tutorial uses a configurable joint, and that was broke in the 3.4 update. In the release notes Unity says they fixed it, but it seemed to be working fine before, now it is certainly broke. You can no longer make it work in world space.
     
  6. Kid Germ

    Kid Germ

    Joined:
    Jul 30, 2011
    Posts:
    6
    I thought I was losing my mind. Thanks for your help
     
  7. zine92

    zine92

    Joined:
    Nov 13, 2010
    Posts:
    1,347
    Thanks for the links. Guess they should fix it soon.
     
  8. Gopher42

    Gopher42

    Joined:
    Oct 19, 2011
    Posts:
    30
    Ran into the same problem, found this thread which helped resolve it. One note, the spaceship in the demonstration level doesn't seem to be an instance of the prefab, so I had to manually change the instance of the ship as well.