Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Detecting how a ball collided with another ball.

Discussion in 'Physics' started by codejoy, Apr 25, 2018.

  1. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    I have a ball that can land on top of another ball. If this happens I want it to know which side it lands on (not relative to rotation relative to the main ball whose landing on top of the ball). How does one say: "okay a collision happened...now how did it actually hit? so i can respond the right way? Giving it a bit of force in the right direction (not wanting to use the bounce materials from the physics engine for this). Just want to know hey it hit it on top left corner. Push it away in that direction a bit.... My current best idea for this is 8 collision boxes on the top of the sphere in each direction and cardinal direction. Has to be a better way.



    Screen shot of sort of what I mean... (ball is about to land on top of stone on the right ish, topish, or top rightish side of the stone sphere. ...
     

    Attached Files:

  2. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    897
    In your Collision you can find the contact points that generated the collision.
     
  3. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    oh awesome I didn't know I could get the contact points. It totally works thanks!