• 9
• 10
• 9
• 10
• 10
• entries
72
38
• views
22279

# hahaha

89 views

Well I was thinking, about my problem. Yeah that one, in the last post. So I guess I just had to get out the old pen and paper, and try to do what I think it should be doing. The problem was, the original formula I got the math from, called for the param planeD. Which was described as "planeD; // p * planeNormal = planeD". And you should know by now that p = wtf?! to me. So I was trying to find something I thought p should be, so I threw in the sphere center. Things wernt working, I would debug to see that things were being tested inverted. So I reversed the cases, and poked at this and flipped that. And it did work, but only when the sphere had the exact inverted direction as the plane. And that means that it would go past the plane sometimes before thinking it hit. Pretty easy to see, because I made the sphere-plane collision cause a deletion of the spheres node. I like it. I got to test my collision code, and my linked list 'random' node deletion. Joy.

But I know you are really just here because I post alot of code, so drink up!
bool	CColSphere::TestPlane(const CColPlane &s, float tcount){	// the distance from this spheres center point	// to the planes center point.  dot product to get	// distance in planes normal direction.	float	d = (s.Direction * (s.Internal - Internal));	if(d <= -Radius)	// on backside on planes normal?		return false;	// dont test the back	// move it for this time frame and test to see if	// we are now less than the spheres radius distance	// sphere to plane on planes normal.	Vector3	moving = (Direction * (Velocity / (1.0f / tcount)));	Vector3 test = moving+Internal;	d = (s.Direction * (s.Internal - test));	if(d >= Radius)		// still 'in-front'		return false;	// no hit	return true;	// went from, in-front to (atleast) into plane}

Next test on the list is going to be the planes with/heigh check. Should be a sinch, but dont worry, I'll screw it up.

There are no comments to display.