Door Swing Both Ways
-
Hey gang, I've run into an interesting problem...
I am building a DC that has a door swing that happens when the user uses the "Interact" tool on the door. It works much like this one:
http://sketchup.google.com/3dwarehouse/details?mid=17d06108c6a8e562de650492e45fb14f&prevstart=0
Here's my problem, I need the user to have a choice of the swing, whether it the door hinges from the left or right. Now I know you could just "flip" the component. In the case of the door I am using as an example, that would work fine. In the DC that I am building, this wouldn't work.
Since DC's can't command sub components to flip themselves, or change their axes, I have to figure out how to accmplish this with math.
So lets say when the user clicks on the door, ROTZ is animated to a positive angle of 120 Degrees. If I wanted that swing to be the opposite, I would have to use a value of -110. Then I would have to move the door back out, and then to the right.
This is more of a math problem really then a DC problem. Does anyone have a DC that they have made like this, or perhaps could suggest how to approach the math end of this problem?
-
Couldn't you simply make two door-leaves with appropriated flipped handle/butts, and the call one or the other to be visible when the door handing toggles as it flips ?
When it's flipped you toggle the swing [RotZ] +/- ve ?
There are only two versions as the other two possibilities are simply the DC facing the opposite way when placed ?? -
I have done that exact method in other components. The problem here is in this particular component, the user will be able to specify how many doors they want to have, and then be able to go in and configure the swing of each door. Since I will never know how many doors someone will want, I need to set it up so they can choose the swing for each door.
Plus, I am trying to make this component as light as possible, so the more things I can copy, and configure with math, rather then showing/hiding tings the better.
-
Eric,
This may give you some ideas:http://forums.sketchucation.com/viewtopic.php?f=289&t=21350
...........
Howard L' -
I've seen that door, its really awesome.
The solution in that door for reversing the swing is not going to work for me. I need a door to swing the opposite direction upon user selection without flipping it around.
Essentially, If the door was hinged left, or in other words, its axis rotation point was on the left, I need for it to appear to the user that its hinged on the right, without actually being hinged on the right.
-
Ok, I have attached a more updated file.
If you click on Dynamic Component options you will see a choice for right and left. Try left and see what happens, then right. You can see that while I have the correct animation attributes animating, I don't have the correct formulas... (or really any formulas at all)
I think this is in the world of Algebra and Calculus. My problem is I just don't know where to even begin with the formulas.
When you are trying to get a door to appear to swing right, I need to animate its Y rotation angle to a negative. As that angle changes, the distance I need to move the door in a positive Z direction also changes. If I can figure out that distance I am set. I adjust the Z position, then just offset the size of the door in X and I am good to go.
My research as lead me to this, and I am still trying to make heads or tails of it...
http://en.wikipedia.org/wiki/Exact_trigonometric_constants
The answer I think lies with PIE, Angle, and LenX of the doors, I just don't know how to put it all in a formula.
Any math geeks out there?
-
HA! I got it, with the help of a local math genius.
Check out the solution attached. Just open the Dynamic Components option and switch the hinging from left to right and use the interact tool on the door.
SIN was the answer!
(fist pump)
Advertisement