Whoa! This is some wierd collision
Hey everyone,
I finnaly got some simple boundin' box collision figured out, but there's a wierd problem. My camera is based on the one from apron tutorials. Well here's what i did. There's a wall at z = 28. So i made an if else statement -
if ( objCamera.mPos.z > 28.0f)
{
objCamera.mPos.z -= 2.0f;
}
Ok, cool. So to test it, i ran into the wall. For a few seconds it stopped me, but then i broke though. When i stepped back, it had increased the camera's speed in all directions signifigantly ( did i spell that right? :P ).
Kinda wierd. So, what do i do about this??
o_0
~
Thanks :D
Mike
It's the apron tutorials camera, quite a bit of code
http://www.morrowland.com/apron/tut_gl.php
it's the first person cam
http://www.morrowland.com/apron/tut_gl.php
it's the first person cam
heh i had this problem before as well, i know you've figured it out already, because it's one of those silly things that you realize is obvious but it bugged me for like half an hour when i was first learning openGL :P
its like, because you're saying "if i cross this line, push me back this far", if you might get pushed back a little but then be able to skip past the line, and it wont do anything.
also, if you use objCamera.mPos.z >= 28.0f instead of just >, the same thing could happen. thats why i tend to use collision prediction instead of detection, so that movement is inhibited when you reach a collision, not reversed. know what I mean?
like the wall stops them, because they bumped into it, it doesn't spit them out because they moved inside of it.
its like, because you're saying "if i cross this line, push me back this far", if you might get pushed back a little but then be able to skip past the line, and it wont do anything.
also, if you use objCamera.mPos.z >= 28.0f instead of just >, the same thing could happen. thats why i tend to use collision prediction instead of detection, so that movement is inhibited when you reach a collision, not reversed. know what I mean?
like the wall stops them, because they bumped into it, it doesn't spit them out because they moved inside of it.
how about
maybe that will stop you from braking through...
if ( objCamera.mPos.z > 28.0f) { objCamera.mPos.z -= (the distance moved since last visit)}
maybe that will stop you from braking through...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement