Hit Detection When rotating the camera
Posted
by
SD1990
on Game Development
See other posts from Game Development
or by SD1990
Published on 2012-10-30T10:31:27Z
Indexed on
2012/10/30
11:22 UTC
Read the original article
Hit count: 205
c++
|collision-detection
This bug/feature has been plaguing me for a while and i want to know the best way to fix it. I'm testing simple hit detection with a wall, like:
if (Forward button)
if(Inv.w.z < -49 || Inv.w.z > 49)
pos.z = 0.0f;
else if(Inv.w.x < -49 || Inv.w.x > 49)
pos.z = 0.0f;
else
pos.z = +1.0f;
where Inv.w. is the camera positions. Now obviously when i now hit that certain point i can no longer move away from the wall or anywhere in fact. How can i change this code to allow for the camera to be turned away from the wall so therefore i should be allowed to move?
for example, the player hits the wall and i cant move until i turn around or to the side?
I know its something to do with velocity but im pretty new to this so please bare with me if this is easy.
© Game Development or respective owner