Over 10 Million Study Resources Now at Your Fingertips

Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Pages: 2

Unsigned collisiondetector sphere sphere

284 Chapter 13 Generating Contacts

Excerpt from src/collide_fine.cpp

Separating axes between a box and a sphere.

The fnal phase of our algorithm is to fnd the closest point i
point and generate the contact from it. We’ll do this frst in the
This is a simple process. All we need to do is to clamp each
point to the half-size of the box in the same direction. With
then work out the distance from the center of the sphere to th
if it is larger than the radius of the sphere. The code for this is simple:

Excerpt from src/collide_fine.cpp

13.3 Primitive Collision Algorithms

dist = relCenter.x;
if (dist > box.halfSize.x) dist = box.halfSize.x; if (dist < -box.halfSize.x) dist = -box.halfSize.x; closestPt.x = dist;

dist = relCenter.y;
if (dist > box.halfSize.y) dist = box.halfSize.y; if (dist < -box.halfSize.y) dist = -box.halfSize.y; closestPt.y = dist;

Excerpt from src/collide_fine.cpp

// Compile the contact.



const Sphere &sphere,
CollisionData *data

How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Make payment
Document download
Download File
PageId: ELI0343F4A
Uploaded by :
Page 1 Preview
unsigned collisiondetector sphere sphere
Sell Your Old Documents & Earn Wallet Balance