ContactReport / Collision Question

__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?

betajaen

06-06-2006 20:57:41

Could you, attach a camera to a body itself? Perhaps making it kinematic and in a collision group which detects collisions but does not act upon them.

Or use a modified character controller.

__bf_ddc__

06-06-2006 21:30:04

I was fooling around with the character controller earlier, but it just didn't seem to work well with what I had already; I have multiple scene managers, and multiple cameras; sometimes a couple viewports being shown. So as far as that went, it wasn't even updating the mCamera, when attached to the player...

@attaching the camera to a body itself:
Is this what you mean:
mBody->mNode->attachObject(mCamera);

Then move the mBody according to the keyboard input, and hopefully the camera will update itself? Then making it kinematic and adding it to a collision group...

betajaen

06-06-2006 22:17:04

Basically yep.