Public Group

# Plane/Sphere Collision Detection

This topic is 3076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey guys,

I've been making a little 3D pong clone using Direct3D 9 and C++. I've got my meshes created/textured/imported and the scene's all set up how I want it.

I'm just a little bit stumped on how to handle collisions between the ball and the paddle?

I've looked into AABB collision detection and I have a little bit set up:

<code>
BYTE* vertices;

if(FAILED(hr)) PostQuitMessage(0);
D3DXVECTOR3 minBounds, maxBounds;

</code>

All credit to http://www.toymaker.info/Games/html/collisions.html

But obviously this only gives me a bounding box for object space, how do I convert the minBounds and Maxbounds vectors into world space so I can test to see if the ball intersects with them?

As usual any help is appreciated.

Ollie.

##### Share on other sites
Does the paddle have a fixed orientation? If so, just add the paddle's position to the min and max vectors of the AABB to yield the world-space AABB.

##### Share on other sites

I'm not entirely sure what fixed orientation means.. But if I understand correctly then yes it does, the paddle does not rotate and can only move in the XY plane.

Please excuse my ignorance if I got that completely wrong! =P

##### Share on other sites
Quote:
 Please excuse my ignorance if I got that completely wrong! =P
No, you got it right.

##### Share on other sites
Great thanks =)

So I'll add the paddle's position vector to both the minBounds and maxBounds vector, then do the same thing with the sphere's and use the conventional methods to see if they intersect.

Thanks for all the help JyK.

1. 1
2. 2
3. 3
Rutin
21
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 10
• ### Forum Statistics

• Total Topics
633653
• Total Posts
3013148
×