Quantcast
Viewing all articles
Browse latest Browse all 75

How to use Contact Points to change direction of Ball

Hello, I'm trying to build a simple Breakout game and I'm trying to get the ball to change direction depending on where it hit the paddle. Here is the code I have at the moment. Sorry if it seems completely wrong this is my first time using Contact Points. function OnCollisionEnter (col : Collision) { for (var contact : ContactPoint in col.contacts) if (contact.thisCollider == col) { //This is the contact point of the Paddle float contact = contact.point.x - transform.position.x; } } Thanks in advance.

Viewing all articles
Browse latest Browse all 75

Trending Articles