Advertisement

oglman's code

Started by May 14, 2002 01:18 AM
4 comments, last by Shutterbug 22 years, 9 months ago
Few days back I got the collision detection code "made by oglman", his nick here used on the forum. It works great with tut 10,but i dont undestand why he is sometimes adding the bounding volume and sometimes subtracting it. I here put a prt of the code if (normal==2 && facenorm==2 && dir==0) // If Face Normal Equals Z, We are Moving towards Z, and Direction moved is forwards { if (g_zposfacez1)// If The X position is on the positive side of the 1st Z Vertex // Add the bounding spehere to the position dest=g_zpos-((float)cos(g_heading*PI/180) * 0.05f+bounding); if (((g_zposfacez1)||(g_zpos>facez1 && dest=facex1 && g_xpos<=facex2)||(g_xpos<=facex1 && g_xpos>=facex2))) // If our path passes through the Z section of the plane and we are within the beginning //and end of the plane result=true; } why is the addition and subtraction of bounding sphere occuring ?when is he adding it and when is he subtracting it. Please gimme some description of reason behind this occurence Shutterbug
OK COMPUTER!!
Use code tags when posting source code to make it readable.
Advertisement
the code can be found here
Shutterbug
OK COMPUTER!!
errr here
http://www.geocities.com/michael53711/index.htm
OK COMPUTER!!
OK...the collision code doesn''t use an actual bounding sphere per se it simply adds the radius of the sphere to the direction you''re travelling to prvent you from moving too close to the wall. However, if you are travelling along the negative axis, it must subtract the radius of the "bounding sphere" to prevent you from moving too close to the wall. Sorry if that isn''t clear, as it is kind of hard to explain. if you still have trouble, try playing around with that part of the code and see if that helps you understand the significance of that part.
Thanks
btw is that your real e-mail add
if not please post one we can use to contact you directly

Shutterbug
OK COMPUTER!!

This topic is closed to new replies.

Advertisement