UNITY 3D: how to create a lever to control animation of an object ..such as a trap
Hi, does anyone has any suggestion or tutorial on how to make a simple lever as picture show below.. I want to use it to control animation of other object..
Really appreciate anyone can stop by and leave a comment.. Thanks..
Answer by hexagonius · Jan 18, 2016 at 08:18 PM
well, place it in the scene. Add a sphere collider to it. In a script on the lever you can check for input in OnCollisionStay, if the staying object is the player. if you pressed a button, call SetBool or something like that on the Animator component to change its state.
That's a basic approach, but will work, but for it to be realised, I think you'll have to dig into scripting and the Unity docs yourself. Otherwise you'll just get this running and won't be able to get very far on your own.
Answer by hexagonius · Jan 17, 2016 at 06:27 PM
Either create it with Unity's primitives, or use a 3D modelling tool like blender or 3DsMax to model it out.
Hi, really appreciate your help.. Can i ask how about the scripting of the system using C# ?
$$anonymous$$eaning that after having my lever with animation up and down.. So how to make the lever to control the animation of another game object?
Thanks..