Local orientation problem

Hi,

I am using a MultiShapeEntity with boxes, and I have a strange problem when I try to set the local orientation of the boxes: when there is only one box all is fine, and the physics and visual entities have the right position and orientation. But when there is two or more boxes, the positions are ok, but not the orientations. The physics entities are correctly oriented, but the visual entities are oriented with the opposite angle.

Here is the code that I am using:

BoxShape box1 =newBoxShape(

newBoxShapeProperties(0,

newPose(

newVector3(posX2, posY2, posZ2),

UIMath.EulerToQuaternion(new xna.Vector3(0, angle, 0))),

newVector3(dimX1, dimY1, dimZ1))

);

BoxShapes.Add(box1);

BoxShape box2 =newBoxShape(

newBoxShapeProperties(0,

newPose(

newVector3(posX2, posY2, posZ2),

UIMath.EulerToQuaternion(new xna.Vector3(0, angle, 0))),

newVector3(dimX2, dimY2, dimZ2))

);

BoxShapes.Add(box2);

What am I doing wrong?

Thanks

Adeline

[2980 byte] By [adeline.paiement] at [2008-1-7]
# 1

You're not doing anything wrong, you found a bug in our code. Fortunately, there is a work-around you can use. You need to override the Render method on MultiShapeEntity with the following code. In your case, you should create a new FixedMultiShapeEntity class that inherits from MultiShapeEntity and overrides this method.

You must also add a reference to Microsoft.Xna.Framework.dll to make this code compile. If you don't already have a reference to this DLL, you can find it under c:\windows\assembly\GAC_32\Microsoft.Xna.Framework.

Here is the fix:

Code Snippet

public override void Render(RenderMode renderMode, MatrixTransforms transforms, CameraEntity currentCamera)
{
if ((Flags & VisualEntityProperties.DisableRendering) > 0)
return;

transforms.World = World;

foreach (VisualEntityMesh mesh in Meshes)
Render(renderMode, transforms, mesh);
}

-Kyle

KyleJ-MSFT at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 2

It works now, thank you very much!

Adeline

adeline.paiement at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...

Microsoft Robotics Studio

Site Classified