I went and downloaded a Blender model for a closet door that features door folding - when you pull open a door and it folds in half as it opens. The model in Blender contains some armatures for pushing and pulling open the doors while in Pose mode. It’s pretty neat, but trying to re-create this feature in Unity has left me pretty lost. I tried fiddling with the model in Unity via changing the rig settings in the model import settings (sadly, I have very little knowledge in rigging so I’m not quite sure what I’m doing), attempting to attach the folding doors as rigidbody objects with a hinge joint (no dice), creating an animation with the folding doors (which I also have no experience in and would create a result that wouldn’t be what I’m looking for, details below), and some variants of those attempts.
My desired end result would be to have a working closet door that would behave similarly to a single rigidbody door with a hinge joint. I have a current system for doors that behaves similarly to the grabbing system in popular survival horror games like Amnesia: The Dark Descent. It needs tweaking, but gets the main idea across for the time being.
I wouldn’t be asking a forum unless I was very lost on a problem, which I am right now. In what way could I start working to achieve this result? Alternatively, would it be easier to just trigger a door-opening animation when I left-click on the closet door (which I really want to avoid)?
I kinda made a solution. The idea is to use hinge joints on the door parts in conjunction with a script that moves the hinge.
I’ve attached a unity package with the scene and a script. It should be self-explanatory, but the idea is this:
for each door (that is, one of the two moving doors that make up the whole closet door):
1: Put two hinge joints on both of the door pieces. Connect one of the joints to the central hinge of the door, and the other to that piece’s side of the door. This will make both of the door pieces move to stay in a line between the hinge and the side.
2: Create a script that defines a circle around each side of the door, and positions the hinge in the intersection of those two circles.
3: Move the hinge, and see the magic happen.
Hope that helps, feel free to ask questions. I shamelessly grabbed the circle intersection code from stack overflow, so the variables there are poorly named, and I have no idea what’s going on in that method*.* Trig stuff is my best bet.
I’m looking for this exact solution, for decorative Japanese style folding room divider. @ I tried your example package but it does not work. When I play it in Unity the red handle is not selectable.
Don’t necro years old threads. Also don’t @ the wrong user. “baset was last seen: Sep 12, 2014”
I have no idea what OP was asking for, or what solution I gave them. I replied over three and a half years ago. So Idk. Create a new thread and explain your problem,
Also… this level of forum incompetence makes it seem like you’re probably also too incompetent at other things to be able to understand any help you’d be given anyway.