Page 1 of 1

Scaling anomoly

Posted: Tue Nov 05, 2013 2:27 am
by tadmiral
Can anyone explain why this isnt scaling correctly while the other objects are.
physicserror.jpg
physicserror.jpg (30.36 KiB) Viewed 2622 times
Here is the creation code:

Code: Select all

                
// Rotation Matrix and quanternion for rotation
                Matrix rotationY = Matrix.CreateFromAxisAngle(Vector3.UnitY, MathHelper.ToRadians(mapObject.gameObject.rotation.Y));
                Matrix rotationZ = Matrix.CreateFromAxisAngle(Vector3.UnitZ, MathHelper.ToRadians(mapObject.gameObject.rotation.Z));
                Quaternion objectAngleY = Quaternion.CreateFromRotationMatrix(rotationY);
                Quaternion objectAngleZ = Quaternion.CreateFromRotationMatrix(rotationZ);
                Quaternion objectAngles = objectAngleY * objectAngleZ;

                // Creates physics object
                Vector3[] vertices;
                int[] indices;
                TriangleMesh.GetVerticesAndIndicesFromModel(mapObject.gameObject.model, out vertices, out indices);
                AffineTransform newATransform = new AffineTransform(new Vector3(mapObject.gameObject.scale), objectAngles, mapObject.gameObject.position);
                mapObject.physicsMesh = new StaticMesh(vertices, indices, newATransform);
                space.Add(mapObject.physicsMesh);

Re: Scaling anomoly

Posted: Tue Nov 05, 2013 7:27 pm
by Norbo
Nothing seems out of the ordinary. If other meshes work, it's probably something related to the data/properties related to that specific mesh.

You might want to try it out in the BEPUphysicsDemos to have a more direct visualization of the physical result.