How can I get the Text component from TextMeshPro ? I'm getting null exception
NullReferenceException in Unity
How to add a browser tab icon (favicon) for a website? Finite ring has only zero divisors and units Ball to Ball Collision - Detection and Handling With the help of the Stack Overflow community I've written a pretty basic-but fun physics simulator.    You click and drag the mouse to launch a ball.  It will bounce around and eventually stop on the "floor".  My next big feature I want to add in is ball to ball collision.  The ball's movement is broken up into a x and y speed vector.  I have gravity (small reduction of the y vector each step), I have friction (small reduction of both vectors each collision with a wall). The balls honestly move around in a surprisingly realistic way.  I guess my question has two parts:   What is the best method to detect ball to ball collision? Do I just have an O(n^2) loop that iterates over each ball and checks every other ball to see if it's radius overlaps? What equations do I use to handle the ball to ball collisions? Physics 101 How does it effect the two balls speed x/y vectors?  What is the resulting direction the two balls head off in?  How do I apply this to each ball?     Handling the collision detection of the "walls" and the resulting vector changes were easy but I see more complications with ball-ball collisions.  With walls I simply had to take the negative of the appropriate x or y vector and off it would go in the correct direction.  With balls I don't think it is that way.  Some quick clarifications: for simplicity I'm ok with a perfectly elastic collision for now, also all my balls have the same mass right now, but I might change that in the future.    Edit: Resources I have found useful  2d Ball physics with vectors:  2d Ball collision detection example:     Success!  I have the ball collision detection and response working great!  Relevant code:  Collision Detection:  for (int i = 0; i &lt; ballCount; i++)   {       for (int j = i + 1; j &lt; ballCount; j++)       {           if (balls[i].colliding(balls[j]))           {             balls[i].resolveCollision(balls[j]);         }     } }   This will check for collisions between every ball but skip redundant checks (if you have to check if ball 1 collides with ball 2 then you don't need to check if ball 2 collides with ball 1.  Also, it skips checking for collisions with itself).  Then, in my ball class I have my colliding() and resolveCollision() methods:  public boolean colliding(Ball ball) {     float xd = position.getX() - ball.position.getX();     float yd = position.getY() - ball.position.getY();      float sumRadius = getRadius() + ball.getRadius();     float sqrRadius = sumRadius * sumRadius;      float distSqr = (xd * xd) + (yd * yd);      if (distSqr &lt;= sqrRadius)     {         return true;     }      return false; }  public void resolveCollision(Ball ball) {     // get the mtd     Vector2d delta = (position.subtract(ball.position));     float d = delta.getLength();     // minimum translation distance to push balls apart after intersecting     Vector2d mtd = delta.multiply(((getRadius() + ball.getRadius())-d)/d);        // resolve intersection --     // inverse mass quantities     float im1 = 1 / getMass();      float im2 = 1 / ball.getMass();      // push-pull them apart based off their mass     position = position.add(mtd.multiply(im1 / (im1 + im2)));     ball.position = ball.position.subtract(mtd.multiply(im2 / (im1 + im2)));      // impact speed     Vector2d v = (this.velocity.subtract(ball.velocity));     float vn = v.dot(mtd.normalize());      // sphere intersecting but moving away from each other already     if (vn &gt; 0.0f) return;      // collision impulse     float i = (-(1.0f + Constants.restitution) * vn) / (im1 + im2);     Vector2d impulse = mtd.normalize().multiply(i);      // change in momentum     this.velocity = this.velocity.add(impulse.multiply(im1));     ball.velocity = ball.velocity.subtract(impulse.multiply(im2));  }   Source Code:     If anyone has some suggestions for how to improve this basic physics simulator let me know!  One thing I have yet to add is angular momentum so the balls will roll more realistically.  Any other suggestions?  Leave a comment! Override back button to act like home button Drawing/Sketching Tool for elaborating questions More often than not I need to elaborate my question put up on Stack Overflow with a custom sketch, UML class diagram, flow chart.    It is in these times I have to open up a custom paint software, factor out some diagrams, export it as an image, attach it to Stack Overflow. I wouldn't know how complicated it is to invest in having such a sketching or drawing tool integrated, It could even be a basic pen stripped off all the advanced features leaving it a bare minimum.  Such a tool if incorporated into the Stack Overflow "ask question" UI would be certainly helpful.  As of Today this Question has been visited around 170 times and 7 answers, This was meant to be the voice of Stack Overflow users. Would you need a Drawing Tool for you on the Stack Overflow site, would it help you to express you questions and answers better? Sadly, only 2, or 3 answers are in the context of the question. The bounty was meant to be a bait and even that ends tomorrow. Hope you'll get the will and the zest to comment on this question today and in the future . What is the use of multiple main methods? What can a soldier requisition and for how long? In the military rank feature it says the soldier can "requisition simple equipment or a horse for temporary use". What qualifies as simple equipment, any simple weapon or something less complex than a catapult?  Additionally, which part of the sentence is the "for temporary use referring to, the simple equipment and the horse or just the simple equipment? I am designing the layout for a touchscreen for outside use, What are some good color combination to use that will be visible under the sun light for outside use? Maybe bright neon colors? How to install pip for python 3 in ubuntu 12.04 LTS Flow On Schedule I"ve created a flow that I'd like to run monthly on the 7th day of each month. How can I do this with scheduled apex. I have no experience writing apex from scratch. Any suggestions or starting off points appreciated.  Thanks,  Kris Does Airplane Mode allow GPS location to pass through? This is what I saw when my plane was taxing to the runway at CDG:     Airplane mode was on and all other transmissions (except Location), including WiFi, mobile data, NFC and Bluetooth were off.  Location was not manually turned on by me, after I enabled Airplane Mode. It remained turned on.  What am I missing? Is GPS now so widely accepted on-board planes that Android changed its configuration to let this kind of signal/communication to pass through Airplane mode "block"?  I believe that  isn't a duplicate, because at that time (2016) Location was generally "included" in Airplane mode and was turned off by enabling it. I put a video in my pdf with Acrobat and there I can watch my video. But if I open the pdf on my mobile, I can't watch the video, I only see an image. Is there a way to watch videos of a pdf in a mobile? I have a samsung J5. Do different databases use different name quote? For example, mysql quote table name using   SELECT * FROM `table_name`;   notice the `   Does other database ever use different char to quote their table name I stopped dual booting and I don't want to have to choose the OS any more. I want to boot into Ubuntu 12.04 directly without seeing the GRUB menu.  How can I achieve that? Is it "legal" to CREATE and DROP #SomeTable more than once? Install software from packages, or build it from source? This is a  about when to use packaged software and when to build and install it yourself.   When should I install software from packages provided by my OS distribution, instead of building and installing it myself from source?  When is it better to build from source? In Blender 2.8, how do I light an EEVEE scene with an HDR? How to change the camera from Landscape to Portrait I need a way to render a picture that is longer heighth-wise than width-wise. Changing the scale of the camera does nothing. I've been told to look in the scene focus settings, and I didn't see anything. Is there a way to change the shape of the rendered image? I try to understand and visualize myself covariance matrix. Supposing I have a matrix A = [ 2 3 4; 5 5 6 ], how do I calculate its covariance matrix, and what is its practical meaning? (All I was able to understand by now is that on the diagonal of the covariance matrix, variances for particular variables are placed, and on the upper and lower fields correlations between those variables.) What does this mean? "Your UK visa application has been issued" Your UK visa application has been issued.      PLEASE DO NOT GO TO THE VISA APPLICATION CENTRE BEFORE THEY CONTACT YOU.      You will be contacted by the Visa Application Centre when your documents are ready for collection, or have been dispatched via courier where this is relevant.       You are reminded that you should avoid making travel plans until you have collected your passport, as the outcome of your visa application is not final until you receive your passport.      Please ensure you check the details on your visa when collecting your passport. If you need to contact us you can do so via our International Enquiry Service at www.gov.uk/contact-ukvi-outside-uk      Kind regards,      UK Visas and Immigration   British Embassy Abu Dhabi     Your UK visa application has been issued.   I know words like processed, forwarded, received, refused but never heard anything like that, so I am confused.