O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Collision Radius

You’ll notice from the last section that the sphere couldn’t get close to the cone. You can specify how close to or far from an object you can get by specifying a radius using the EntityRadius command. You specify the radius for the individual objects. Let’s continue with the same program we were using in the last section. If you’ve closed it, open the file called demo11-03.bb. We simply changed the previous program a tiny bit. The change between demo11-02.bb and demo11-03.bb is highlighted in bold below.

; Creating a sphere
sphere=CreateSphere()
ScaleEntity sphere, 0.5,0.5,0.5
PositionEntity sphere, -3,0,5
EntityType sphere,type_player
EntityRadius sphere, 0.2

Go ahead and run the program now, and you’ll see that you can get ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required