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
Post a Comment