Forum rules - please read before posting.

How to disable rigidbody and save object's position?

Hello again ;)

I need some help, guys. I suppose it's more of a Unity question, but perhaps you can give me some advice ;)

In the scene I'm working on, there's a bunch of bricks (cube objects) with box colliders and rigidbody components. Player can knock them down, then enter a hole that's revealed. The problem is, I want the bricks to remain in the knocked down position after leaving/re-entering the scene. Or loading a saved game.

I guess the way to do it would be to disable Rigidbody component, but other than through script, I have no idea how to do it. Let me add that that while I've got a lot of the game made already I am still a scripting noob and made most of it using AC editor alone... ( totally possible! ;) )

The game is 2D with 3D elements (like the bricks). Screens:

AC version 1.56g


  • I've found a workaround for now. I made another object that's a ready-made pile of bricks in a knocked down position and I make the one with rigidbody invisible when leaving room and one without becoming visible. Also added to *on load cutscene to switch them around if variable changes.

    Sorry for bothering you! ;) Though I am still curious how else it could've been done ;)
  • I guess you could put a "remember transform" script on the bricks for them to remembered between scenes and save games. Not sure about disabling rigid body though.
  • Disabling the Rigidbody itself shouldn't be necessary - I believe you'd just need to enable the Is Kinematic checkbox.

    Adding a Remember Transform component would store the position, but not anything about the Rigidbody.  There would also be issues if you saved while the bricks were in motion, since you'd need the forces / velocities to be saved as well.  For a more general solution, I'd recommend writing a custom Remember script to save all that you need.

    One other option might be to animate the value of the Rigidbody's Is Kinematic toggle in a standard Unity Animator, since AC can save Animator components with the Remember Animator component.  Depending on the complexity of your scenario, that combined with a Remember Transform may be enough.

    Just thinking aloud, though - if your workaround works and you're new to scripting it's probably best to leave as-is.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.