1

Closed

Question about "IsDynamic"

description

In the sample game of QS engine, when I set the "IsDynamic" property of "WoodenCrate" to true, the position of rendering component will be different from the position of physics component. It means that the ball can across some areas of the "WoodenCrate".
 
"IsDynamic" refers to the WoodenCratePhysics.xml

file attachments

Closed Jan 6, 2012 at 3:56 PM by LordIkon
Fixed in v0.26

comments

LordIkon wrote Dec 29, 2011 at 6:27 AM

The wooden crate in the demo is already dynamic. I am confused what the exact problem is. The positions between the render and physics positions can differ for up to a single frame if you're running at a fixed framerate, but for longer if you're not at a fixed framerate and your framerate is really high. This is rarely noticeable, you would need to be at either a slow framerate or have a very fast moving dynamic object to notice this.

wrote Dec 29, 2011 at 7:18 AM

jasonk525 wrote Dec 29, 2011 at 7:18 AM

I want to make the crate fixed and have no physics effect, so I set the "IsDynamic" property to false.

=======FixedWoodenCratePhysics.xml=========
<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
<Asset Type="QuickStart.Components.PhysicsComponentDefinition">
<ShapeType>Box</ShapeType>
<IsDynamic>false</IsDynamic>
<Density>0.4</Density>
<PhysicsModelPath>Models/WoodCrate/Crate1</PhysicsModelPath>
<Height>1</Height> 
<Width>1</Width>
<Depth>1</Depth>
<Radius>0.5</Radius>
</Asset>
</XnaContent>

=========FixedCrate.xml==========

<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
<Asset Type="QuickStart.Entities.ComponentDefinition[]">
<Item>
  <type>RenderComponent</type>
  <XMLDefinitionPath>Render/WoodenCrateRender</XMLDefinitionPath>
</Item>
<Item>
  <type>PhysicsComponent</type>
  <XMLDefinitionPath>Physics/FixedWoodenCratePhysics</XMLDefinitionPath>
</Item>
</Asset>
</XnaContent>

When I create an entity of type of FixedCrate, the physics bounding is deviated from rendering bounding. Please see the below screenshot.

LordIkon wrote Jan 1, 2012 at 12:46 AM

Ah, ok screenshot says it all. This looks like a bug, not something you've done wrong. I'll look into a fix for this in v0.26, which may come in the next week or so.

wrote Jan 4, 2012 at 5:54 AM

wrote Jan 4, 2012 at 6:00 AM

LordIkon wrote Jan 4, 2012 at 2:53 PM

I have this fixed internally, I will release the fix with v0.26, which will be within 1-3 days I'm hoping. The problem is that JigLibX creates box physics where the position set is at the corner of the box, and the QuickStart Engine puts render meshes so they're centered at the position that is set. So the center of the render meshes is lining up with a corner of the box physics. The fix is to make sure physics shapes have local transforms so that they'll end up centered at the same position as the render meshes.

wrote Jan 6, 2012 at 3:56 PM

wrote Feb 14, 2013 at 9:36 PM

wrote May 16, 2013 at 11:01 AM