xadh00m
26-05-2008 15:19:59
Hi!
I have a problem with windows (and maybe doors) within my scene. They
are jointed by ONE revolute joint on the rotation axis side of the panel on middle height.
But if the panel is significantly broader then high, the gravitation pulls the panel a bit down on the opposite side.
Is there a way of fixing the joint axis in a way to fix that problem?
Thx
(Using NxOgre 0.9 and PhysX 2.7.2)
xadh00m
27-05-2008 11:40:28
If my question is not clear enough, please just ask...
xadh00m
27-05-2008 18:10:06
Ok here is a picture of my problem. Maybe this helps a bit.
As you can see, there is a crack over the window panel and the frame.
Whereas the revolute joint is fixed at the opposite side...
Any suggestions?
betajaen
27-05-2008 18:48:24
Are you sure, you have the global positions of the joints right? Otherwise the mass of the window could be off, or something of the left joint is different. Perhaps some code would be nice.
xadh00m
28-05-2008 10:01:55
*snip*
mNxBody->setGroup("Door");
JointParams jointParams;
jointParams.setToDefault();
jointParams.mHasLimits = true;
jointParams.mBreakableMaxForce = 500;
jointParams.mLowerLimitRestitution = 0.0f;
jointParams.mUpperLimitRestitution = 0.0f;
if(StringUtil::endsWith(mMeshName.getString(), "flipped.mesh", false))
{
jointParams.mLowerLimit = -1.0f * NxPi;
jointParams.mUpperLimit = 0;
}
else
{
jointParams.mLowerLimit = 0;
jointParams.mUpperLimit = 1.0f * NxPi;
}
mNxRevoluteJoint = nxScene->createRevoluteJoint(mNxBody, mAnchorDir, mAnchorPos, jointParams);
The if statement just decides the opening direction.
To make it clear: I only have one joint at the right (picture) side of the window. The rotation side.
At the opposite side there is no joint. At this side the window hangs down a bit pulled by gravity.
How can I setup the joint, so that it keeps the window "stronger" in the horizontal position?
betajaen
28-05-2008 11:04:25
I would suggest having a joint on the other side as well, but it depends on how the windows opens. Does it open upwards or in to the room? Otherwise you could move the joint to the middle of the frame than the far right you have now.
xadh00m
28-05-2008 13:40:31
Ok, I think this picture makes things clearer.
As you can see there is a (one) vertical revolute joint at the right side. Its axis is aligned vertical (0,1,0).
But it seems that this joint is not strong enough to hold the whole window in the horizontal position (crack above the window panel)...
betajaen
28-05-2008 14:45:11
Oh. I understand now.Try playing around with the NX_FROZEN_BF flags in the Actor. Limiting the actor to; only one axis of rotation and a frozen Y axis may do the trick.
xadh00m
28-05-2008 15:58:33
Ahh, ok I will try that. Thank you!
If the joint breaks and the windows falls to the ground, do I have to unfreeze
the actor? If so, is there a way to monitor the joint state with a callback?
reptor
28-05-2008 16:47:47
That kind of design is bad and not only in your computer simulation. You need to put two hinges if you want it to be a believable window hinge arrangement.
In another words, that won't work in real life so why are you modelling it?
Actually for a window dimensioned and positioned like that, I would put two hinges to the top of the window and not to the side.
betajaen
28-05-2008 16:49:19
@xadh00m
Yep to both questions. It's a JointCallback.
@reptor
It isn't too bad. It can just be a very strong hinge joint.
reptor
28-05-2008 16:53:33
It isn't too bad. It can just be a very strong hinge joint.
No, it's definitely a bad design. Make a window like that in real life and you will see what I mean. If one wants to model it properly in a computer simulation, it should not be like it is in the photo. If you want to simulate real-life physics and hinge arrangements then that's not good at all.
xadh00m
28-05-2008 16:56:08
Ok I understand what you want to say. The decision to take one joint per window was for performance issues. Currently there are nearly one hundred
doors and windows in my scene...
reptor
28-05-2008 17:06:07
Oh I see, I can understand why you don't want to model it like how it should be done outside a computer.
Indeed, a proper hinge arrangement for that would be to put two hinges to the top of the window. That is, I bet, how you will find them placed if you go and look for that kind of window somewhere near you.
I was actually wondering when I saw this topic, that why are you modeling the window like that at all? I don't know what kind of an application you are creating. If it is a game then it is a bit questionable if you really want to model the windows to be openable at all (because it's going to be a lot of work).
I am interested in how these kinds of things are done with NxOgre/PhysX and this thread is good, make no mistake about my intentions. It's just that my studies and work are related to designing mechanical things so it is quite natural for me to start looking at how you put your hinges
I am a person who, when I go to put juice bottles into my fridge, look that the weight put into the door is not too much, and that if I place things to the door of the fridge, I place them as close to the hinges as possible so that the load on the hinges is as small as possible (I laugh at myself too).
xadh00m
29-05-2008 11:13:03
Ok, I know this window should have a horizontal rotation axis at the top or,
how it is designed in Autodesk ADT, where I get it from, at the upper third of
the window. That seems to be an architectural standard (I´m not an
architect). I took this window as example because it is much broader than
high, but the problem exists with doors and other windows, too.
Reptor you say, that I should ensure that the weight of the window is not too high, so
that the joint can hold it. But if that would be true, there must exist a value
for the joint which specifies, how much angular force it can handle before it leans in that direction, which could be adapted instead...
PS: Yes, it is horrible to get CAD data into an ogre properly and they are not optimized in any way!