• Create Account

Need scary sound effects or creepy audio loops for your next horror-themed game? Check out Highscore Vol.3 - The Horror Edition in our marketplace. 50 sounds and 10 loops for only \$9.99!

### #Actualcaldiar

Posted 05 October 2012 - 12:18 PM

I see a 'motion' vector which I would take to mean your velocity.

Merely altering the position of the ball on collision will do nothing in changing the velocity (which determines the moving direction) of the ball.

I'm unclear on how you're determining how the ball moves through the game world. Are you simply adding to position every update tick or are you doing proper movement with distance = velocity * time (assuming constant velocity since this is pong)?

When the ball collides with a surface, you will need to reflect the velocity vector. Merely changing the sign from negative to positive or vice versa will give you weird results. You would notice this any time the ball is going in a diagonal motion. XNA vectors provide a Reflect method to do just that.

### #1caldiar

Posted 05 October 2012 - 12:17 PM

I see a 'motion' vector which I would take to mean your velocity.

Merely altering the position of the ball on collision will do nothing in changing the velocity (which determines the moving direction) of the ball.

I'm unclear on how you're determining how the ball moves through the game world. Are you simply adding to position every update tick or are you doing proper movement with distance = velocity * time (assuming constant velocity since this is pong)?

When the ball collides with a surface, you will need to reflect the velocity vector. Merely changing the sign from negative to positive or vice versa will give you weird results. You would notice this any time the ball is going in a diagonal motion. XNA vectors provides a Reflect method to do just that.

PARTNERS