Strange collisions of BoxShapes
Hi everybody,
I played around a bit with MultiShapeEntity and built some kind of wall. It's about 4 meters wide and 3 meters high with a mass of about 900 kg inspired by the TableEntity of SimulationTutorial2. Additionally I put a simple box in my simulation environment with 0.4x0.2x0.2 meters in dimension and a mass of 1 kg, it looks like this:
http://www.lespocky.de/kram/wall_before.jpg
Now I configured the camera to have a solid body about the simulation menu and moved it against the wall causing the wall to fall. The wall fallsthrough the box and after that the box lies on the wall, looking like that:
http://www.lespocky.de/kram/wall_after.jpg
Now that's not physic as I remember. What's going wrong here?
btw: this web forum editor is crazy. It costed me almost a half hour to write a good looking post and I still didn't get pictures included. The HtmlView tab bugs me, 'cause HTML I type seems to be ignored.
<P>mass of the wall was about 900 kg. <IMG src="http://forums.microsoft.com/MSDN/WebResource.axd?d=NySzF1eivP_rMoc50GQJzcvS4MHMOEKwYrCIgDtzuzlw7GsNki3H_INlfYaLgkxFmac-VIm2t3F15sLUhe5iKuA0JNA_VrWx4LNOoZPN6Cc1&t=633142628060000000"></P>
<P> </P>
<P align=left>I have another strange thing. I improved the wall and set a door in (without joints, it's very hard to understand joints from the tutorial <IMG src="http://forums.microsoft.com/MSDN/WebResource.axd?d=NySzF1eivP_rMoc50GQJzcvS4MHMOEKwYrCIgDtzuzlw7GsNki3H_INlfYaLgkxFSSG0MZbJ1z6uFFjZvu3APg2&t=633142628060000000">). The wall is one MultiShapeEntity and the door is another, both containing just simple BoxShapes:</P>
<P align=left> </P><FONT size=1>
<P align=left></FONT><FONT color=#0000ff size=1>
<DIV class=codeseg>
<DIV class=codecontent>
<DIV class=codesniptitle><SPAN style="WIDTH: 100%">Code Snippet</SPAN></DIV>
<P align=left><FONT color=#0000ff size=1>public</FONT><FONT size=1> DoorEntity(</FONT><FONT color=#008080 size=1>Vector3</FONT><FONT size=1> position, </FONT><FONT color=#0000ff size=1>float</FONT><FONT size=1> doorWidth, </FONT><FONT color=#0000ff size=1>float</FONT><FONT size=1> doorHeight, </FONT><FONT color=#0000ff size=1>float</FONT><FONT size=1> doorThickness)</P>
<P align=left>{</P>
<P align=left>m_doorWidth = doorWidth;</P>
<P align=left>m_doorHeight = doorHeight;</P>
<P align=left>m_doorThickness = doorThickness;</P>
<P align=left></FONT><FONT color=#008000 size=1>// Setze Position des ganzen MultiShapeEntity auf die übergebene Position</P></FONT><FONT size=1>
<P align=left>State.Pose.Position = position;</P>
<P align=left></FONT><FONT color=#008000 size=1>// Shape für das Türblatt</P></FONT><FONT size=1>
<P align=left>m_doorLeaf = </FONT><FONT color=#0000ff size=1>new</FONT><FONT size=1> </FONT><FONT color=#008080 size=1>BoxShape</FONT><FONT size=1>(</P>
<P align=left></FONT><FONT color=#0000ff size=1>new</FONT><FONT size=1> </FONT><FONT color=#008080 size=1>BoxShapeProperties</FONT><FONT size=1>(</P>
<P align=left>0.0f, </FONT><FONT color=#008000 size=1>// Masse 0, wird nachher über Dichte gesetzt</P></FONT><FONT size=1>
<P align=left></FONT><FONT color=#0000ff size=1>new</FONT><FONT size=1> </FONT><FONT color=#008080 size=1>Pose</FONT><FONT size=1>(</FONT><FONT color=#0000ff size=1>new</FONT><FONT size=1> </FONT><FONT color=#008080 size=1>Vector3</FONT><FONT size=1>(0, 0, 0)), </FONT><FONT color=#008000 size=1>// relativ zum Ursprung des MultiShapeEntity</P></FONT><FONT size=1>
<P align=left></FONT><FONT color=#0000ff size=1>new</FONT><FONT size=1> </FONT><FONT color=#008080 size=1>Vector3</FONT><FONT size=1>(m_doorWidth, m_doorHeight, m_doorThickness)</P>
<P align=left>)</P>
<P align=left>);</P>
<P align=left>m_doorLeaf.State.TextureFileName = </FONT><FONT color=#800000 size=1>"Wood_cherry.jpg"</FONT><FONT size=1>;</P>
<P align=left>m_doorLeaf.State.MassDensity.Density = 0.46e3f; </FONT><FONT color=#008000 size=1>// mittlere Dichte für Holz</P></FONT><FONT size=1>
<P align=left></FONT><FONT color=#008000 size=1>// jetzt noch die einzelnen Shapes zu BoxShapes hinzufügen, die </P></FONT><FONT size=1>
<P align=left></FONT><FONT color=#008000 size=1>// ist in MultiShapeEntity public deklariert und muss aus der </P></FONT><FONT size=1>
<P align=left></FONT><FONT color=#008000 size=1>// abgeleiteten Klasse heraus definiert werden</P></FONT><FONT size=1>
<P align=left>BoxShapes = </FONT><FONT color=#0000ff size=1>new</FONT><FONT size=1> </FONT><FONT color=#008080 size=1>List</FONT><FONT size=1><</FONT><FONT color=#008080 size=1>BoxShape</FONT><FONT size=1>>();</P>
<P align=left>BoxShapes.Add(m_doorLeaf);</P>
<P align=left>}</P></FONT>
<P align=left> </P></DIV></DIV>
<P align=left> </P></FONT>
<P>As you can see I now set density instead of mass and get another strange behaviour: </P>
<P align=left> </P>
<P align=left><IMG src="http://www.lespocky.de/msrs/wall_in_door_far.jpg"></P>
<P align=left> </P>
<P align=left><IMG src="http://www.lespocky.de/msrs/wall_in_door_near.jpg"></P>
<P align=left> </P>
<P align=left>All I did was pushing the door a little into the "door frame" to see it collide with the wall, but it goes into (!) the wall. <IMG src="http://forums.microsoft.com/MSDN/WebResource.axd?d=NySzF1eivP_rMoc50GQJzcvS4MHMOEKwYrCIgDtzuzlw7GsNki3H_INlfYaLgkxFwAr0uh1RPOKhICkOAso47ykZzTt59GYICFvFgYER8fE1&t=633142628060000000"></P>
<P align=left> </P>
<P align=left> </P><FONT size=1>
<P align=left></P></FONT>
*argh* The editor component of this board really sucks. 
Again: mass of wall was about 900kg.
I stepped ahead and improved my wall and added a door. Each are MultiShapeEntities containing simple BoxShapes, e.g. the constructor of my door:
Code Snippet
public DoorEntity(Vector3 position, float doorWidth, float doorHeight, float doorThickness)
{
m_doorWidth = doorWidth;
m_doorHeight = doorHeight;
m_doorThickness = doorThickness;
// Setze Position des ganzen MultiShapeEntity auf die übergebene Position
State.Pose.Position = position;
// Shape für das Türblatt m_doorLeaf =
new BoxShape( new BoxShapeProperties( 0.0f,
// Masse 0, wird nachher über Dichte gesetzt new Pose(new Vector3(0, 0, 0)), // relativ zum Ursprung des MultiShapeEntity new Vector3(m_doorWidth, m_doorHeight, m_doorThickness) )
);
m_doorLeaf.State.TextureFileName =
"Wood_cherry.jpg"; m_doorLeaf.State.MassDensity.Density = 0.46e3f;
// mittlere Dichte für Holz // jetzt noch die einzelnen Shapes zu BoxShapes hinzufügen, die // ist in MultiShapeEntity public deklariert und muss aus der // abgeleiteten Klasse heraus definiert werden BoxShapes =
new List<BoxShape>(); BoxShapes.Add(m_doorLeaf);
}
As you can see I use density instead of mass now. I pushed my wall a little in direction of the door and thought the would collide, but the door just moved right into (!) the wall:
http://www.lespocky.de/msrs/wall_in_door_far.jpg
http://www.lespocky.de/msrs/wall_in_door_near.jpg
Did I miss something on setting up correct physics of my box shapes?