Scaling anomoly

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
tadmiral
Posts: 9
Joined: Thu Oct 07, 2010 10:06 am

Scaling anomoly

Post by tadmiral »

Can anyone explain why this isnt scaling correctly while the other objects are.
physicserror.jpg
physicserror.jpg (30.36 KiB) Viewed 2621 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);
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Scaling anomoly

Post 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.
Post Reply