Original Post
I have 2 3D vectors. One being the original position, the 2nd being the target position. I'm trying to simply interpolate between the two. I should note I'm using the Configurable Math Library (love it), but I figure this is just a basic math issue that I'm probably doing incorrectly than anything wrong with the library so I didn't feel the need to post this on their specific forum. Code: I'm probably missing something very simple since my brain is a bit fried currently and this is my first attempt at something like this. Thanks for the help. [Edited by - ChaosPhoenix on August 2, 2009 4:42:22 PM]
// ms_OriginalPos = Vector3
// ms_targetPos = Vector3
// ms_interpValue = float between 0.0 - 1.0
vector3 nlerpVec = cml::nlerp(ms_originalPos, ms_targetPos, ms_interpValue);
// Returned vector is normalized, so multiply it by the original length/magnitude to get the correct position.
float magnitude = (ms_targetPos - ms_originalPos).length();
vector3 newPosition = (nlerpVec * magnitude);
setPosition(newPosition);