Hello there. In my game I want my character to ride a machine/horse/thing so what I want is:
stop near the "device", push "Fire1" button and the character be riding the device.
What I did was to make the character (character controller based) be parented to the device, kill the inputs and let it be carried by the device.
Everything works almost fine but the device becomes crazy, even if i didnt apply anything to it, just rigidbody and collider.
how can I do it work????
I would implement STATES into my script.
and in the Update() loop/event, you make a switch that only runs whats active in current state.
A state can be made with a simple variable. If you only have two states in total, you can just use a Boolean. But if you think you might have even more vehicles or activities I would recommend an Integer for state.
The state variable is just a "private variable" you keep within your object.
If you want pretty code, you can implement the state with an Enum for the state.
If you need an example, then look in my previous answers. Search by clicking on my profile name and check or be lazy: http://answers.unity3d.com/questions/24378/unity-design-patterns/30102#30102 :-)
You have to make sure that what you are turning off is your character motor script, not the controller itself, since many things have @require component on them… If you look very closely, when you pause the game, that component often turns right back on even if you have turned it off, causing the craziness(possibly) you were talking about! From what I understand, you need to instead make a reference to only the character motor portion of that script and enabling/disabling that. I know this answer is late, hopefully this can help people in the future trying to understand this type of thing though.