Bullet object passing through other dynamic objects

  ... the Physics Box2D Extension for AndEngine.

Bullet object passing through other dynamic objects

Postby OzLark » Fri Mar 02, 2012 3:42 pm

In my game if I fire my projectile fast enough, it may pass through or even embed its self into other dynamic or static objects..

What's going on? If I slow the projectile down it behaves okay, but fast and weird stuff starts!

Any ideas?
Did this post help you? Feel free to return the gesture by downloading Ninja Bees, creating a level (or more) and sharing it to the Ninja Bees website!

Ninja Bees - Our latest Android game, check it out on Google Play (free) or paid with no ads
OzLark
 
Posts: 1130
Joined: Sun Feb 05, 2012 3:19 am


Re: Bullet object passing through other dynamic objects

Postby recastrodiaz » Fri Mar 02, 2012 10:38 pm

Taken from the Box2D Manual:

Fast moving objects in Box2D can be labeled as bullets. Bullets will perform CCD with both static and
dynamic bodies. You should decide what bodies should be bullets based on your game design. If you
decide a body should be treated as a bullet, use the following setting.

bodyDef.bullet = true;

The bullet flag only affects dynamic bodies.
Box2D performs continuous collision sequentially, so bullets may miss fast moving bodies.
recastrodiaz
 
Posts: 26
Joined: Mon Aug 22, 2011 11:32 pm
Location: Lyon, France

Re: Bullet object passing through other dynamic objects

Postby OzLark » Sat Mar 03, 2012 8:04 am

Thanks for your replies,

My problem was caused by:

this.mPhysicsWorld.setContinuousPhysics(false);

Removed this call and all seems fine again!

I already had the body set as a bullet, so I was somewhat stumped.

Cheers.
Did this post help you? Feel free to return the gesture by downloading Ninja Bees, creating a level (or more) and sharing it to the Ninja Bees website!

Ninja Bees - Our latest Android game, check it out on Google Play (free) or paid with no ads
OzLark
 
Posts: 1130
Joined: Sun Feb 05, 2012 3:19 am


Return to Physics Box2D

Who is online

Users browsing this forum: No registered users and 8 guests