Jump to content
  • Advertisement
Sign in to follow this  
football94

3D collision detection

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys

 

Ive been working on a project in which Im in the beginning phases of collision detection

right now Im trying to get the bounding spheres of my bullet point sprites to collide

with my sphere model  but when I fire the bullets at the model my audio collision flag

does not fire, if anyone could point out what Im doing wrong it would be much appreciated.

 

 

   Thankyou

 

  private void UpdateBulletPositions(float moveSpeed)
        {
            for (int i = 0; i < bulletList.Count; i++)
            {
                Bullet currentBullet = bulletList[i];
                MoveForward(ref currentBullet.positionfire, currentBullet.rotationfire, moveSpeed * 2.0f);
                bulletList[i] = currentBullet;



                BoundingSphere bbaall = new BoundingSphere(ball1.Position, ball1.Model.Meshes[0].BoundingSphere.Radius *
                                      ShipBoundingSphereScale);
                


                BoundingSphere bulletSphere = new BoundingSphere(currentBullet.positionfire, 0.05f);
                //CollisionType colType = CheckCollision(bulletSphere);


                if (bulletSphere.Intersects(bbaall) )
             
                {
                  
                    soundHyperspaceActivation.Play();
                    

                   
                }
                
            }
            
            
        }

Share this post


Link to post
Share on other sites
Advertisement

If it's not firing then they are not colliding. Try drawing the bounding sphere and see if the radius on the bullet sphere is too small. But this is something you'll have to step through and see what's going on. As far as I can tell, you're setting up the bounding spheres correctly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!