# Collision Quirk : Mystery collision shape propagating

I am having a difficult time debugging the collision portion of my code.

I have an actor with a child CollisionSphere and have registered a CollisionHandlerPusher (also tried the CollisionHandlerFluidPusher, and PhysicsCollisionHandler with same results) to push against the actor. I have defined a CollisionPolygon facing the correct direction to act as a wall. I have also set the setRespectPrevTransform(True).

The CollisionHandlerPusher seems to be working well from the sense that it is pushing against the actor. When the actor approaches the wall at an angle, it slides across it. However, after colliding with the wall when the actor is still pressing against the wall, a strange collision shape is propagating past the wall.

I have the actor moving with a posInterval with fluid=1 and bakeInStart=0 (and have also tried motion using a task). The interval is set to move forward for a certain duration so that if it hits the wall at an angle it will still glide.

showCollisions(True) results in the following image. At point of collision with the wall, the white box starts traveling from the actor and beyond. This is a problem because the white box seems to think it is the actor’s CollisionSphere and is triggering collision events with other objects.

What is that white object? How do I prevent this from happening?

Image:

That white box is the object’s sphere. Or, more precisely, it represents the deepest point of penetration into the space before the sphere was reset out of the space by the collision handler.

So, if you’re seeing that box move deeper and deeper into the wall, it means your sphere is moving deeper and deeper into the wall each frame, but the collision handler is resetting it back outside the wall each frame so that’s where you see it by the time it is drawn. But each frame, something (I’m guessing your interval) is moving it right back where it was, deep into the wall.

Solution: pause the interval when the collision is first detected.

David

Great! I still want it to glide along the wall, so I went back to using a task, but changed it based on your feedback.

Before, I was doing something like this within my task:

end_pos = start_pos + velocity * task.getElapsedTime()

Based on your guidance, I changed it to this:

end_pos = actor.getPos() + velocity * time_step

And now it seems to be working. I tried to use the task.getDt() instead of time_step, but for some reason it was slowing my object down by orders of magnitude. Not sure if I misunderstood that.

Thanks so much!