Question

just got started with XNA and this example would help out a lot!

I´ve done a simple test where i got some terrain and a ball, when the ball hits the terrain it stops. This i do by setting the ball position to just on top of the terrain on collision.

To my question, im using bounding box for this, but it doesnt look very well if the ball hits the terrain from the left or right side since it respawns on top. How do i check of it hits on side?

Short glitch of the code right now:

if (playerOne.BoundingBox.Intersects(terrain.BoundingBox)

   playerOne.Position.Y = terrain.BoundingBox.Top;

Where playerOne is the ball.

Thanks in advance!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top