Example #1
0
 private bool BallHitPaddle2(SphereData ball, CubeData paddle)
 {
     return((ball.position.Z - 1 <= paddle.position.Z + paddle.zScale && ball.position.X >= paddle.position.X - paddle.xScale && ball.position.X <= paddle.position.X + paddle.xScale && ball.position.Y >= paddle.position.Y - paddle.yScale && ball.position.Y <= paddle.position.Y + paddle.yScale));
 }
Example #2
0
 /// <summary>
 /// Updates the position of the ball based on its speed.
 /// </summary>
 /// <param name="ball">The current ball</param>
 /// <param name="time">The current time elipased</param>
 /// <param name="position">The current ball's new position</param>
 private void UpdateBall(SphereData ball, float time, out Vector3 position)
 {
     position = ball.position + ball.velocity * time;
 }