Object A is moving via. 2D rigidbody by velocity V and in script is defined breaking power P. Every frame of breaking (P * Time.deltaTime) is subtracted from velocity V (in other words, ignoring mass). How i can calculate distance D required to slow down to target velocity tV ?
I'm not actually using force/power but i setting velocity directly with this line of code :
Vector3 dir = transform.TransformDirection(Vector3.up);
ship.rb.velocity = Vector2.MoveTowards(ship.rb.velocity, (dir * maximalSpeed) * ship.massModifier, speedGain / ship.massModifier);
I'm self-learning Indie developer and i need this for AI to my game. Enemy in space ship have nothing like space-breaks so only way how to slow down is to turn ship by 180 degrees and thrust forward in counter-direction.I need to know this to calculate distance from target required to slow down and prevent possible collision with target.