C++ vector(math) destination, check range based on movement -


i moving entity new position vector, when reaches it's destination, it's jumping around destination. want check on range of destination based on movement speed, can how go this?

here function:

void enemy::onupdate(graphics& graphics) {         //function called every tick     vector dest(190.f, 250.0f);     vector destination = dest - posvec;      vector normalise = vector::unitvector(destination);      mposvec = mposvec + normalise * mvelocity;//mvelocity = 4.f      mx = mposvec.x;     = mposvec.y;          //clamp range         //if(something) }  

thanks.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -