I got some code that im tweaking. Ive almost got it to work. It doesn't seem to work right though. First when it first starts in my INIT function that I set to target 50,0,0, it jets off way to fast. Here is what im doing.
seek(IvVector3 target)
{
IvVector3 desired = target - position;
desired.Normalize();
desired = desired * maxspeed;
IvVector3 steer = desired - velocity;
if(steer.LengthSquared() > maxforce * maxforce)
{
steer.Normalize();
steer *= maxforce;
}
applyForce(steer);
}
void applyForce(IvVector3 Force)
{
acceleration = Force;
}
In my update Function
velocity += acceleration;
if(GetKeyState(0x31))
{
seek(IvVector3(0,0,50));
}
if(GetKeyState(0x32))
{
seek(IvVector3(-50,0,0));
}
position += (velocity * mTimer.DeltaTime());
TESTS = XMMatrixTranslation(position.x,0,position.z);
// Reset acceleration to 0 each cycle
acceleration.IsZero();
Also when it reaches the target, it completey stops instead of going back and forth