HorizontalMotionConstraint.Update questions
Posted: Fri Jan 27, 2012 9:33 pm
In HorizontalMotionConstraint.Update in the character controller, I noticed something that probably wasn't intended:
Regardless of HasTraction, it uses the supportData.Normal.
I noticed this when my code managed to generate a NaN in this method due to the supportData.Normal being (0,0,-1) which led to the velocityDirection.Normalize() doing a divide by zero (the character is walking off the edge of a cube).
I'm curious, there is a comment about "This method can return false when the line is parallel to the plane, but previous tests and the slope limit guarantee that it won't happen.". I was looking for these tests and slope limits, and I'm not yet seeing what this is referring to. Anyone have any tips there?
Thanks
Code: Select all
Plane plane = new Plane(character.SupportFinder.HasTraction ? supportData.Normal : supportData.Normal, 0);
I noticed this when my code managed to generate a NaN in this method due to the supportData.Normal being (0,0,-1) which led to the velocityDirection.Normalize() doing a divide by zero (the character is walking off the edge of a cube).
I'm curious, there is a comment about "This method can return false when the line is parallel to the plane, but previous tests and the slope limit guarantee that it won't happen.". I was looking for these tests and slope limits, and I'm not yet seeing what this is referring to. Anyone have any tips there?
Thanks