Whoa! This is some wierd collision

Started by
5 comments, last by Beaverbutt8 18 years, 4 months ago
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
Advertisement
Show us the camera code.
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
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
wait! hold that thought, i figured out something! yay!
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.
|aaap.penopticon.com| My website, including game projects. Collaboration/comments are welcome, please visit :)
how about
if ( objCamera.mPos.z > 28.0f) { objCamera.mPos.z -= (the distance moved since last visit)}

maybe that will stop you from braking through...
What i did was, instead of push my player back, i just stopped him - prediction, like AAPP said


if ( objCamera.mPos.z > 28.0f)
{

-CAMERASPEED;

}
As simple as that :)

This topic is closed to new replies.

Advertisement