I finally got it to work, thanks to all that helped.
My situation seemed different and the normal solutions didn't seem to fix the issue.
Here is what I had to do:
1. Set a lookAt variable
lookAt = Camera.GetFrontPosition(.005f);
2. Set the lookAt of the mesh
Mesh.LookAtPoint(lookAt);
3. Use the lookAt vector to convert to "local space"
vLocal = MathLibrary.ConvertToLocalSpace(lookAt, Mesh.GetPosition());
vLocal.y = 0;
Physics.SetBodyLinearVelocity(iPhysicsBody, vLocal, false);
4. Use the Inverse function to go the opposite direction.
Note: The ConvertToLocalSpace function may be incorrect because the SetBodyLinearVelocity function only works correctly with the localSpace flag set to false.
public static TV_3DVECTOR ConvertToLocalSpace(TV_3DVECTOR worldSpace, TV_3DVECTOR center)
{
TV_3DVECTOR retVector = new TV_3DVECTOR();
retVector.x = center.x - worldSpace.x;
retVector.y = center.y - worldSpace.y;
retVector.z = center.z - worldSpace.z;
return retVector;
}
public static TV_3DVECTOR Inverse(TV_3DVECTOR v)
{
TV_3DVECTOR retVector = new TV_3DVECTOR();
retVector.x = v.x - (v.x * 2);
retVector.y = v.y - (v.y * 2);
retVector.z = v.z - (v.z * 2);
return retVector;
}
Thanks again!