Jump to content

  • Log In with Google      Sign In   
  • Create Account


#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