__bf_ddc__
06-06-2006 20:29:03
Hello again,
I've set up a contact reporter for my collision detection; ran a few tests, and it worked just fine. I basically have a bool catching whether something's colliding with the camera or not (a body is attached w/the camera and moves right with it), where it's set to true in onStartTouch() and set to false in onEndTouch().
Unfortunately, when I implemented it into the moveCamera() class, the collision takes place, reads it as collided, but the camera still slowly goes through the wall or whatever object it's colliding with. In the moveCamera() function, I check if that boolean is false, if so then the camera will move. Obviously if it's being read as true [aka the contact reporter seeing a collision taking place], it won't catch the line to move the camera. Simple logic, yes?
What do I do to make the camera not slowly go through the other bodies, but rather stop in that direction to not go past the collided object?
I've set up a contact reporter for my collision detection; ran a few tests, and it worked just fine. I basically have a bool catching whether something's colliding with the camera or not (a body is attached w/the camera and moves right with it), where it's set to true in onStartTouch() and set to false in onEndTouch().
Unfortunately, when I implemented it into the moveCamera() class, the collision takes place, reads it as collided, but the camera still slowly goes through the wall or whatever object it's colliding with. In the moveCamera() function, I check if that boolean is false, if so then the camera will move. Obviously if it's being read as true [aka the contact reporter seeing a collision taking place], it won't catch the line to move the camera. Simple logic, yes?
What do I do to make the camera not slowly go through the other bodies, but rather stop in that direction to not go past the collided object?