playMaker

Author Topic: Collision Question  (Read 556 times)

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Collision Question
« on: October 23, 2021, 04:36:42 PM »
Hello,

I have a ball that when I hit a button it applies force either left or right (depending if I hit the left or right button). When it collides with another ball, it needs to push that ball in the direction that it was going in and the first ball needs to stop moving. Essentially, it needs to transfer the force to that ball. How do I do this? Thanks!

John Bassi

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Re: Collision Question
« Reply #1 on: October 28, 2021, 09:36:11 AM »
There are a couple of ways you could go about this.

1. If you are inputting the amount of force used to push the ball, you can have the ball store that number as a vector3 and when it collides with the other ball, get that vector 3, stop the force from the old ball and apply it to the new one.

2. If you dont store the force in a variable, you could use get velocity to get the vector 3 and do the same steps above with getting and setting the value from the old ball, to the new one.