Forum rules - please read before posting.

Remembering the gravity and freeze position. RememberTransform.cs Script

Hello Chris,

  So, I'm using the RigidBody Pickup script by EpicError Tools that allows a player to lock an object's position and freeze it in the air. The script un-ticks use gravity from the rigid body and freezes the XYZ Pos and rotation. When I attach your RememberTransform.cs script to an object the two scripts work well and it does in fact remember the exact position of the object when saving the game. However, your script does not remember that the object's pos is now frozen and is no longer using gravity. So the objects simply fall after loading the game.

  Is there a snippet of code we can add to your RememberTransform Script so that it remembers if an object has been frozen in place and remembers that the use gravity feature has been ticked off from the rigid body? And where would I pace said snippet into your script?

Thanks! :)


Comments

  • You would be better off writing a new "Remember" script, rather than editing an existing one - otherwise it'll be overwritten when you update AC.

    Have a look at this tutorial - it covers the principles behind saving custom scene data.  You may be able to get by with just making a "RememberGravity" script, so that the RememberTransform handles the rest - otherwise you'll have to combine them into one.
  • Thanks for the advice Chris. I actually found a work around for it. By freezing the POS in the rigid body of the object and turning off gravity AC automatically remembers it that way, and the pickup script alters the rigid body while in scene mode turning off the freeze pos and turning on gravity. Once the player freezes the object to wherever they like it to be the freeze script changes it back to it's original setting. So the player does not even realize the object was frozen in the first place. Other than it will not move until the player clicks on the object. Which is a small setback from my original intention, but it works. 

    Cheers,

    -Adam
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.