Minus paddle

10_br_cud

#1

Hi from the island of Malta!

What a fantastic course!
I have my first question. I couldn’t understand why we are subtracting paddle position from ball position. As below.

 paddleToBallVector = transform.position - paddle1.transform.position;

As I understand:
If paddle is on 5,0 and ball is at 5,1. For me that means 0,1.

What am I missing? :slight_smile:


#2

GOT IT :slight_smile:


#3

Hi Anthony,

What was the solution?


See also:


#4

We subtracted paddle position from ball position to get the difference value.
We later added paddleToBallVector (the difference) to the current paddlePos.
paddlePos has a dynamic value. Allowing it to update position.

Quite straight forward. But my mind did not click :slight_smile:


#5

Sometimes our brains need a bit longer, funnily, often for rather simple ideas. Maybe it’s because we often expect difficult solutions for difficult(?) problems.


#6

So true!


closed #7

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.