- Home /
How to create normal physics reactions when collision is caused by a GameObject controlled by mouse position
My goal is to make an air hockey game. And I've been trying to get the basics of the programming done. As you can see in the attached video, I have a cylinder being controlled by my mouse x and z position. The problem is when the cylinder collides with the other objects, they don't react with force but simply move until the cylinder stops pushing them. The only time they react with a physics reaction is when one of the balls touches another ball, then they start rolling, which is what I'd want to happen when the mouse x/z controlled cylinder hits any of the objects, but it's just not doing it.
I think I might have to somehow calculate the velocity at which the cylinder is moving by my mouse movements, and then use addForce or addForceAtPosition to add forces to the objects hit when hit by the mouse controlled cylinder. Does this make sense?
If any of you know of a good tutorial for making an air hockey game, please post me a link. Thank you.
Also, just a note, you can see in the video that sometimes the cylinder does cause the objects to move, but it only happens when the objects are already in motion, which is strange. The behavior in general of this isn't constant.
Your answer
Follow this Question
Related Questions
Physics AddForce reduced when 3 objects are colliding 1 Answer
Having more than one collider in a GameObject? 8 Answers
Addforce to ball in camera position 0 Answers
Collision impact force 1 Answer