   Collision with moved meshes.
  I'm working on the collision for my student final project and I'm having an issue with my sphere to Mesh collision function when the mesh is not set to the origin. This is because the mesh is built around the origin point and not in the level's world space. To treat collision correctly I will need to calculate as if the Sphere was in the same space as the mesh. What I'm doing right now is calculating a NewSphereMatrix that is the the SphereWorldMatrix * InverseMeshWorldMatrix. I use the sphere's velocity vector in the calculation so I also recalculate the NewVelocity to (SphereVelocity * InverseMeshWorldMatrix) I then do my collision with the new Matrix and new Velocity. The collision function will calculate the final position of the sphere which is then multiplied by the Sphere's world Matrix to get its real position in space. This should work but the sphere ends up just getting pushed around in directions that do not make any sense to me. Any one have an idea of how this could be done better?   
Quote:he collision function will calculate the final position of the sphere which is then multiplied by the Sphere's world Matrix to get its real position in space.If you inverse transform the sphere into mesh space with InverseMeshWorldMatrix, you need to transform it back to world space by multiplying by the mesh's world matrix.;  Assuming "WorldMatrix" means local-to-world, then your NewSphereMatrix is correct...it does put the sphere into the mesh's local space. But your NewVelocity might be wrong...depends on a couple of things. I am assuming that your SphereVelocity is already in world space? If that is true, then you sort of got it right with NewVelocity. But you must be careful when multiplying a pure vector (which velocity is) by a transformation matrix that includes a translation component...Pure vectors should not include that translation. Make sure for velocity that you are only using the 3x3 rotation part of the matrix.So, to summarizeNewSphereMatrix = SphereWorldMatrix * InverseMeshWorldMatrix -> is correctNewVelocity = SphereVelocity_already_in_world_space *InverseMeshWorldMatrix_rotation_part_onlyis what you should do.I'll also say that if you need vertex normals, which are pure vectors, transforming those between spaces can be a bit tricker...if your transformation matrices are not affine.   