# Undeviating bullet in AndEngine

I'm looking for a bullet that can collide with other bodies of the world but doesn't change direction according to collisions. I want the bullet to perform the collisions but without changing its own direction of moving. Basically I want to create a super bullet that can kill multiple bodies available in sequence. Would you have an advice?

If RayCastCallback is part of the solution, then could you tell me how to use it in this case?

AndEngine's physics is based on Box2D. In Box2D , you can create the Body of your bullet with a sensor Fixture. There is a flag you can set on the FixtureDef to make it a sensor. A sensor in Box2D is basically a Fixture that will participate in collisions but not react to collisions on its own which is what you want. You can then provide custom responses to collisions by registering for some callbacks...

From Box2D User Manual:

Sensors do not generate contact points. There are two ways to get the state of a sensor:

1. b2Contact::IsTouching
2. b2ContactListener::BeginContact and EndContact

I'm sure those callbacks/flags are exposed in AndEngine somehow.

The usual way of creating bullets in video games is to perform raycasts, see this question for details. What you want is just a raycast that doesn't stop on the first intersection: there you go, undeviating bullets.

I've no experience with AndEngine so I can't tell you if RayCastCallback will do the trick, but that's possible.